Skip to content

Instantly share code, notes, and snippets.

@madwork
Created July 1, 2019 10:19
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 madwork/8a370de02de8214bbbfcce8a539ee365 to your computer and use it in GitHub Desktop.
Save madwork/8a370de02de8214bbbfcce8a539ee365 to your computer and use it in GitHub Desktop.
require 'benchmark/ips'
Benchmark.ips do |x|
x.report("Kernel") { Hash(nil) }
x.report("Hash") { Hash.new(nil) }
end
# Warming up --------------------------------------
# Kernel 307.226k i/100ms
# Hash 117.067k i/100ms
# Calculating -------------------------------------
# Kernel 9.192M (± 5.7%) i/s - 46.084M in 5.029888s
# Hash 1.729M (± 7.8%) i/s - 8.663M in 5.039179s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment