autocorrect-rb 2.4.1-x86_64-darwin → 2.5.0-x86_64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +20 -1
- data/Rakefile +22 -2
- data/ext/autocorrect/Cargo.toml +1 -1
- data/lib/autocorrect/2.7/autocorrect.bundle +0 -0
- data/lib/autocorrect/3.0/autocorrect.bundle +0 -0
- data/lib/autocorrect/3.1/autocorrect.bundle +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b06e91fbac00e95102d1a0a8a8fd139c0aab35820d82428c3026da3cf4f0683
|
4
|
+
data.tar.gz: a2e74c4c6f6d3532505c644e4d262b9899f53ffcc77bdac6d55e9177df8ecbc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e32c4eeb1f5e307a7c62cb2ca2a611209386af5ba2d0a9457f0b303a524723efdaebe04ae1701e93856ae516d129e125692a33d05066979a2cc42f38ca947cf5
|
7
|
+
data.tar.gz: 819f18584c78867dafa9338d5ff9d8a8faf09b380d3adda87dfbac3fedfdea2a713312ba7a5d5a277c41f64759fc9da20ac0ef4d25608a5990c2b1c5bf52e578
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# AutoCorrect for Ruby
|
2
2
|
|
3
|
+
<a href="https://rubygems.org/gems/autocorrect-rb"><img src="https://img.shields.io/gem/v/autocorrect-rb?color=1&label=Gem" alt="Gem Version"></a>
|
4
|
+
|
3
5
|
The Native Ruby version of [AutoCorrect](https://github.com/huacnlee/autocorrect).
|
4
6
|
|
5
7
|
- Rust - [autocorrect](https://github.com/huacnlee/autocorrect)
|
@@ -55,7 +57,7 @@ ignorer.ignored?("README.md")
|
|
55
57
|
|
56
58
|
## Benchmarks
|
57
59
|
|
58
|
-
🎊 Rust version is
|
60
|
+
🎊 Rust version is ~3.5x faster than the Ruby (pure) version.
|
59
61
|
|
60
62
|
> NOTE: In this case Rust version has more complex rules.
|
61
63
|
|
@@ -74,6 +76,10 @@ Calculating -------------------------------------
|
|
74
76
|
format_html 5.448k (± 1.5%) i/s - 27.250k in 5.002853s
|
75
77
|
```
|
76
78
|
|
79
|
+
```
|
80
|
+
1000 ms / 111904 i/s = 0.008 ms
|
81
|
+
```
|
82
|
+
|
77
83
|
### Pure [Ruby version](https://rubygems.org/gems/auto-correct/versions/1.0.0) result:
|
78
84
|
|
79
85
|
```bash
|
@@ -89,6 +95,19 @@ Calculating -------------------------------------
|
|
89
95
|
format_html 1.659k (± 1.7%) i/s - 8.300k in 5.003164s
|
90
96
|
```
|
91
97
|
|
98
|
+
### Rust version VS Purge Ruby Version
|
99
|
+
|
100
|
+
| Test Case | Duration (Rust) | Duration (Pure Ruby) | Speedup |
|
101
|
+
| ----------- | --------------- | -------------------- | ------- |
|
102
|
+
| Foramt 50 | 0.008ms | 0.031ms | ~3.8x |
|
103
|
+
| Format 100 | 0.017ms | 0.062ms | ~3.6x |
|
104
|
+
| Format 400 | 0.052ms | 0.2ms | ~3.8x |
|
105
|
+
| Format HTML | 0.183ms | 0.67ms | ~3.6x |
|
106
|
+
|
107
|
+
> 🎈 Rust version about 3.5 ~ 3.8x fast then Ruby (pure version).
|
108
|
+
>
|
109
|
+
> By this result, we can see the Ruby version is also fast, but the Rust version is more better.
|
110
|
+
|
92
111
|
## Know issues
|
93
112
|
|
94
113
|
Bundler install error:
|
data/Rakefile
CHANGED
@@ -55,12 +55,12 @@ task :bench do
|
|
55
55
|
end
|
56
56
|
x.report("format 100 chars") do |n|
|
57
57
|
n.times do
|
58
|
-
AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称,【野村:重申吉利汽车(00175)
|
58
|
+
AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称,【野村:重申吉利汽车(00175)“买入”评�� 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称")
|
59
59
|
end
|
60
60
|
end
|
61
61
|
x.report("format 400 chars") do |n|
|
62
62
|
n.times do
|
63
|
-
AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称,上调吉利汽车(00175)目标价12.58%,由15.9港元升至17.9港元,并维持吉汽为行业首选股,重申对其“买入”评级,坚信吉汽长远可成为行业赢家。 该行称,随着公司销量持续复苏及产品组合改善,预计今年销量可达148万辆,同比升9%,较公司原定目标销量141万辆为高。 该行又称称,上调公司今明两年每股盈利预测各13%及升毛利率0.1个百分点,以反映销量较预期高2%及产品组合改善,主要是由领克品牌带动。公司自去年8
|
63
|
+
AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称,上调吉利汽车(00175)目标价12.58%,由15.9港元升至17.9港元,并维持吉汽为行业首选股,重申对其“买入”评级,坚信吉汽长远可成为行业赢家。 该行称,随着公司销量持续复苏及产品组合改善,预计今年销量可达148万辆,同比升9%,较公司原定目标销量141万辆为高。 该行又称称,上调公司今明两年每股盈利预测各13%及升毛利率0.1个百分点,以反映销量较预期高2%及产品组合改善,主要是由领克品牌带动。公司自去年8月开始已持续投资领克品牌及进行市场推广,带动领克销量环比有所改变,��期今明两年领克将占整体销量的11%及14%。 该行表示,由于低端国产车品牌在欠缺新车款及科技下,行业整合度将提升。另外,公司从去年第二季到12月为止,一��都积极推动经销商去库存,这将有利公司今年利润率复苏。")
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -72,5 +72,25 @@ task :bench do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
task :memory do
|
76
|
+
require "memory_profiler"
|
77
|
+
require "./lib/autocorrect-rb"
|
78
|
+
|
79
|
+
html = open("./test/fixtures/example.txt").read
|
80
|
+
|
81
|
+
report = MemoryProfiler.report do
|
82
|
+
20_000.times do
|
83
|
+
AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称,【野村:重申吉利汽车(00175)“买入”评�� 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称")
|
84
|
+
AutoCorrect.format_for(html, "text.html")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
GC.start
|
89
|
+
report.pretty_print
|
90
|
+
|
91
|
+
puts "------------------------- Result Guide -------------------------"
|
92
|
+
puts "If [Total retained] have any bytes, there will have memory leak."
|
93
|
+
end
|
94
|
+
|
75
95
|
task test: :compile
|
76
96
|
task default: %i[test]
|
data/ext/autocorrect/Cargo.toml
CHANGED
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autocorrect-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb_sys
|