Created
August 14, 2016 17:56
-
-
Save flash-gordon/fc9ea08dfe40644a6c5c449dd4c12e39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bundler.setup(:default, :benchmarks) | |
Bundler.require | |
require 'benchmark' | |
require 'benchmark/ips' | |
b = { b: :b } | |
Benchmark.ips do |x| | |
x.report('merge') { { a: :a }.merge(b) } | |
x.report('keywords') { { a: :a, **b } } | |
x.compare! | |
end | |
__END__ | |
Warming up -------------------------------------- | |
merge 51.889k i/100ms | |
keywords 100.272k i/100ms | |
Calculating ------------------------------------- | |
merge 584.229k (± 8.7%) i/s - 2.906M in 5.010994s | |
keywords 1.686M (± 6.5%) i/s - 8.423M in 5.019280s | |
Comparison: | |
keywords: 1685535.9 i/s | |
merge: 584228.6 i/s - 2.89x slower |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment