Skip to content

Instantly share code, notes, and snippets.

@dented
Created July 8, 2013 08:55
Show Gist options
  • Save dented/5947281 to your computer and use it in GitHub Desktop.
Save dented/5947281 to your computer and use it in GitHub Desktop.
random benchmarking
main_hash = {}
time = Benchmark.realtime do
Profiler__::start_profile
(1..10000).each do |number|
simple_hash = {}
simple_hash[number.to_s] = number
main_hash = main_hash.merge(simple_hash)
end
Profiler__::stop_profile
Profiler__::print_profile($stderr)
end
puts "Time elapsed #{time} seconds"
puts "Main hash key count: #{main_hash.keys.count}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment