Skip to content

Instantly share code, notes, and snippets.

@vipulnsward
Created March 29, 2013 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vipulnsward/fa70dec670187713bfd8 to your computer and use it in GitHub Desktop.
Save vipulnsward/fa70dec670187713bfd8 to your computer and use it in GitHub Desktop.
changing merge to merge!
require "benchmark"
N = 1_00_00_000
Benchmark.bmbm do |x|
x.report("Indifferent Access") do
N.times do |i|
HashWithIndifferentAccess.new(i)
end
end
end
=begin
With merge
Rehearsal ------------------------------------------------------
Indifferent Access 9.570000 0.380000 9.950000 ( 9.945525)
--------------------------------------------- total: 9.950000sec
user system total real
Indifferent Access 9.580000 0.370000 9.950000 ( 9.939738)
With merge!
Rehearsal ------------------------------------------------------
Indifferent Access 7.950000 0.610000 8.560000 ( 8.599360)
--------------------------------------------- total: 8.560000sec
user system total real
Indifferent Access 7.960000 0.590000 8.550000 ( 8.553272)
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment