Skip to content

Instantly share code, notes, and snippets.

@vlada79
Created October 11, 2012 18:34
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 vlada79/3874585 to your computer and use it in GitHub Desktop.
Save vlada79/3874585 to your computer and use it in GitHub Desktop.
Mash vs Hash
require 'benchmark'
require 'hashie'
rep = 10_000_000
Benchmark.bm 20 do |x|
x.report 'Hashie(Mash)' do
rep.times do |index|
Hashie::Mash.new({ :name => "User", :age => 21 })
end
end
x.report 'Hash' do
rep.times do |index|
{ :name => "User", :age => 21 }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment