Skip to content

Instantly share code, notes, and snippets.

@havenwood
Forked from bricker/clearbenchmark.rb
Last active December 21, 2015 07:39
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 havenwood/6272523 to your computer and use it in GitHub Desktop.
Save havenwood/6272523 to your computer and use it in GitHub Desktop.
require 'benchmark'
hash = {}
Benchmark.measure do
1_000_000.times do
hash = {}
end
end.real
#=> 0.245904
Benchmark.measure do
1_000_000.times do
hash.clear
end
end.real
#=> 0.073624
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment