Skip to content

Instantly share code, notes, and snippets.

@geraudmathe
Created June 23, 2013 11:48
Show Gist options
  • Save geraudmathe/5844747 to your computer and use it in GitHub Desktop.
Save geraudmathe/5844747 to your computer and use it in GitHub Desktop.
require 'benchmark'
n = 1000000
Benchmark.bm do |x|
x.report("Calling {} ") do
n.times{ hash = {} }
end
x.report("Calling Hash.new") do
n.times{ hash = Hash.new }
end
end
# user system total real
# Calling {} 0.230000 0.000000 0.230000 ( 0.229510)
# Calling Hash.new 0.640000 0.000000 0.640000 ( 0.653439)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment