Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak array construction in
normalize_keys
This results in a performance increase, and reduced object allocation, when normalizing keys - ```ruby report = Benchmark.ips do |x| x.report("concat") do ex = [] ex.concat ['foo'] ex.concat ['bar', 'baz'] ex.concat ['quix'] ex end x.report("splat") do [ *['foo'], *['bar', 'baz'], *['quix'] ] end x.compare! Warming up -------------------------------------- concat 129.103k i/100ms splat 243.963k i/100ms Calculating ------------------------------------- concat 1.176M (± 9.7%) i/s - 5.810M in 5.009251s splat 2.435M (±11.8%) i/s - 11.954M in 5.019257s Comparison: splat: 2434746.6 i/s concat: 1176432.3 i/s - 2.07x (± 0.00) slower ```
- Loading branch information