Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
require 'benchmark/ips'
HASH = Hash[*('a'..'z').to_a]
def fast
Hash[HASH]
end
def slow
HASH.dup
end
Benchmark.ips do |x|
x.report("Hash[]") { fast }
x.report("Hash#dup") { slow }
x.compare!
end