autocorrect-rb 2.4.1-arm64-darwin → 2.5.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c808d95b5c9ffcf3d242d540d2467cd87bcf12bb5a18aaa120243036e2e7e96
4
- data.tar.gz: 9b2270b5cad333870040c8aedf2cbd86c0c931ee21edfb805363be7fc72399d5
3
+ metadata.gz: 452fa4d1250a96ef503cc3ea4e0651154c2f7da110e36b0e8959df690b99ab6d
4
+ data.tar.gz: 8b83eaa987399543d2a7c484555e5f89cb87835ec65e788d5dca2f18b0bd86d1
5
5
  SHA512:
6
- metadata.gz: 43e295ca93c4e6fbf7dfc4ed37a8963b2b0f6465bfd27598ad9ea88b4f7de5e353269d83adc225052a2bac6d1731c950562cbc65aaf0ef547b6088a28eeb0eac
7
- data.tar.gz: c744352f9a4c2ec5f38af9e51dac74b7ec8ffe2495b7dbd2b6bc0c5dd22e5091f0c435430072b3c44beae9b08b33b9ac78d6447851258101f78cdf257b430487
6
+ metadata.gz: c5b66b8925052049e6fc45afbaf0e7518b6da837f8287761c4abd3b72e38154a91c27c058d85eec9811628b6a20d333c2ba1ae50a44c35a3f7823dbef4667175
7
+ data.tar.gz: 3e9a248b861d36e91355b475ee46adccb30c14b11e7b0aaf25a2c8938dd23bd6e3abf2931c92ca14bbc11d5642677c494fe334403667f5c803b1f5ea74647b9e
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 3x faster than the Ruby (pure) version.
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)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称")
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月开始已持续投资领克品牌及进行市场推广,带动领克销量环比有所改变,预期今明两年领克将占整体销量的11%及14%。 该行表示,由于低端国产车品牌在欠缺新车款及科技下,行业整合度将提升。另外,公司从去年第二季到12月为止,一直都积极推动经销商去库存,这将有利公司今年利润率复苏。")
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]
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  edition = "2021"
3
3
  name = "autocorrect-rb"
4
- version = "2.4.1"
4
+ version = "2.5.0"
5
5
 
6
6
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
7
  [lib]
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.1
4
+ version: 2.5.0
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-27 00:00:00.000000000 Z
11
+ date: 2022-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys