autocorrect-rb 2.1.2-arm64-darwin → 2.1.2.beta1-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: 99fc97e0ed6f234d74f09dc82197598f694e87fc39ab8b61da02ebb254e5d53a
4
- data.tar.gz: ba59bed68a882fd5d223ad450f63182609c6ac11740b400ea5f9ae8579cb5606
3
+ metadata.gz: d783c8f798207868dd343de68b239e5e5c51317c39cda2e71aafc90bd18cf3b3
4
+ data.tar.gz: e20d333ce6aad66377d598edf9187ae263a953e02bcc9fe94f5fb5e1dcfd2af2
5
5
  SHA512:
6
- metadata.gz: cdf7d269e269b2c28aebad49aed58030ea814c2587ce2b42a4571910cd3f93f2715aa370d056b27241620dba6b7cb7810dcf851b012f02f7294be5779232007e
7
- data.tar.gz: dbab1ab4e961eab0fd580c9070f42db8d3bcce41b0f7f1d6ed0dbf1cb69bbf53927b607c9e2b604b0535eba766207a2433f04b93de35c41645091a4d791bfc53
6
+ metadata.gz: be27eda0b92c3f5c35eb57a7fc9af8785e64cbf744931f79ddda44183f6ef99ba0472c70f43b245c481f8d2f30cbbc6c058de76d1b91b7eea75a33764fcb2e2b
7
+ data.tar.gz: 6f9e44526a52a1865e20ec6a1a2bba898b946929b540fec405ffa6818c912bffcdd997ddcc7c1152a2a3425c78ce5ec48a49cb8433b8bdc9ee01da2aa5c43fa5
data/README.md CHANGED
@@ -38,3 +38,39 @@ puts result
38
38
  # error: ''
39
39
  # }
40
40
  ```
41
+
42
+ ## Benchmarks
43
+
44
+ 🎊 Rust version is 3x faster than the Ruby (pure) version.
45
+
46
+ > NOTE: In this case Rust version has more complex rules.
47
+
48
+ ### Rust version
49
+
50
+ ```bash
51
+ Warming up --------------------------------------
52
+ format 50 chars 11.348k i/100ms
53
+ format 100 chars 6.033k i/100ms
54
+ format 400 chars 1.772k i/100ms
55
+ format_html 545.000 i/100ms
56
+ Calculating -------------------------------------
57
+ format 50 chars 111.904k (± 3.1%) i/s - 567.400k in 5.075674s
58
+ format 100 chars 58.684k (± 2.1%) i/s - 295.617k in 5.039837s
59
+ format 400 chars 17.266k (± 2.9%) i/s - 86.828k in 5.033234s
60
+ format_html 5.448k (± 1.5%) i/s - 27.250k in 5.002853s
61
+ ```
62
+
63
+ ### Pure [Ruby version](https://rubygems.org/gems/auto-correct/versions/1.0.0) result:
64
+
65
+ ```bash
66
+ Warming up --------------------------------------
67
+ format 50 chars 3.167k i/100ms
68
+ format 100 chars 1.588k i/100ms
69
+ format 400 chars 496.000 i/100ms
70
+ format_html 166.000 i/100ms
71
+ Calculating -------------------------------------
72
+ format 50 chars 31.589k (± 2.5%) i/s - 158.350k in 5.016131s
73
+ format 100 chars 16.122k (± 1.2%) i/s - 80.988k in 5.024082s
74
+ format 400 chars 4.946k (± 2.6%) i/s - 24.800k in 5.017711s
75
+ format_html 1.659k (± 1.7%) i/s - 8.300k in 5.003164s
76
+ ```
data/Rakefile CHANGED
@@ -27,14 +27,44 @@ Rake::TestTask.new(:test) do |t|
27
27
  t.test_files = FileList["test/**/*_test.rb"]
28
28
  end
29
29
 
30
- Rake::ExtensionTask.new("autocorrect") do |ext|
31
- ext.gem_spec = spec
32
- ext.lib_dir = "lib/autocorrect"
30
+ Rake::ExtensionTask.new("autocorrect", spec) do |ext|
31
+ # ext.lib_dir = "lib/autocorrect"
33
32
  ext.source_pattern = "*.{rs,toml}"
34
33
  ext.cross_compile = true
35
34
  ext.cross_platform = CROSS_PLATFORMS
36
35
  end
37
36
 
37
+ task :bench do
38
+ require "benchmark/ips"
39
+ require "./lib/autocorrect-rb"
40
+
41
+ html = open("./test/fixtures/example.txt").read
42
+
43
+ Benchmark.ips do |x|
44
+ x.report("format 50 chars") do |n|
45
+ n.times do
46
+ AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称")
47
+ end
48
+ end
49
+ x.report("format 100 chars") do |n|
50
+ n.times do
51
+ AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称,【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称")
52
+ end
53
+ end
54
+ x.report("format 400 chars") do |n|
55
+ n.times do
56
+ AutoCorrect.format("【野村:重申吉利汽车(00175)“买入”评级 上调目标价至17.9港元】智通财经APP获悉,野村发布报告称,上调吉利汽车(00175)目标价12.58%,由15.9港元升至17.9港元,并维持吉汽为行业首选股,重申对其“买入”评级,坚信吉汽长远可成为行业赢家。 该行称,随着公司销量持续复苏及产品组合改善,预计今年销量可达148万辆,同比升9%,较公司原定目标销量141万辆为高。 该行又称称,上调公司今明两年每股盈利预测各13%及升毛利率0.1个百分点,以反映销量较预期高2%及产品组合改善,主要是由领克品牌带动。公司自去年8月开始已持续投资领克品牌及进行市场推广,带动领克销量环比有所改变,预期今明两年领克将占整体销量的11%及14%。 该行表示,由于低端国产车品牌在欠缺新车款及科技下,行业整合度将提升。另外,公司从去年第二季到12月为止,一直都积极推动经销商去库存,这将有利公司今年利润率复苏。")
57
+ end
58
+ end
59
+
60
+ x.report("format_html") do |n|
61
+ n.times do
62
+ AutoCorrect.format_for(html, "text.html")
63
+ end
64
+ end
65
+ end
66
+ end
67
+
38
68
  task build: :compile
39
69
  task test: :compile
40
70
  task default: %i[compile test]
@@ -0,0 +1,4 @@
1
+ require "mkmf"
2
+ require "rb_sys/mkmf"
3
+
4
+ create_rust_makefile("autocorrect")
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autocorrect-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.2.beta1
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Jason Lee
@@ -34,10 +34,11 @@ extra_rdoc_files: []
34
34
  files:
35
35
  - README.md
36
36
  - Rakefile
37
+ - ext/autocorrect/extconf.rb
38
+ - lib/2.7/autocorrect.bundle
39
+ - lib/3.0/autocorrect.bundle
40
+ - lib/3.1/autocorrect.bundle
37
41
  - lib/autocorrect-rb.rb
38
- - lib/autocorrect/2.7/autocorrect.bundle
39
- - lib/autocorrect/3.0/autocorrect.bundle
40
- - lib/autocorrect/3.1/autocorrect.bundle
41
42
  homepage: https://github.com/huacnlee/autocorrect
42
43
  licenses:
43
44
  - MIT
@@ -56,9 +57,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
57
  version: 3.2.dev
57
58
  required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - ">="
60
+ - - ">"
60
61
  - !ruby/object:Gem::Version
61
- version: '0'
62
+ version: 1.3.1
62
63
  requirements: []
63
64
  rubygems_version: 3.4.0.dev
64
65
  signing_key: