whitequark / parser

A Ruby parser.
Other
1.59k stars 198 forks source link

Optimize duplicate hash key warning #924

Closed dgollahon closed 1 year ago

dgollahon commented 1 year ago

Before

$ hyperfine --warmup 3 'bin/ruby-parse hash_bench.rb'

Benchmark 1: bin/ruby-parse hash_bench.rb
  Time (mean ± σ):      2.678 s ±  0.029 s    [User: 2.613 s, System: 0.061 s]
  Range (min … max):    2.636 s …  2.738 s    10 runs

After

$ hyperfine --warmup 3 'bin/ruby-parse hash_bench.rb'

Benchmark 1: bin/ruby-parse hash_bench.rb
  Time (mean ± σ):     421.3 ms ±   4.1 ms    [User: 366.9 ms, System: 49.9 ms]
  Range (min … max):   414.8 ms … 426.1 ms    10 runs
iliabylich commented 1 year ago

Thanks!

Let me know if you need a release.

dgollahon commented 1 year ago

Thanks for the fast review/merge!

Let me know if you need a release.

I'm not personally in any rush--I just happened to be following the related issue and it seemed like a fun, targeted fix.

prikha commented 1 year ago

Awesome effort @dgollahon!

@iliabylich it'd be awesome to have a release, not urgent but some day.

iliabylich commented 1 year ago

@prikha I've released 3.2.2.1