Skip to content

Instantly share code, notes, and snippets.

@marocchino
Created December 22, 2014 11:09
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 marocchino/d66f629223a623da001f to your computer and use it in GitHub Desktop.
Save marocchino/d66f629223a623da001f to your computer and use it in GitHub Desktop.
require 'benchmark'
n = 5_000_000
Benchmark.bm do |x|
x.report { n.times do ; { "x" => 1, "y" => 2}; end }
x.report { n.times do ; { 'x' => 1, 'y' => 2}; end }
end
# first
# user system total real
# 3.820000 0.100000 3.920000 ( 3.941016)
# 3.710000 0.070000 3.780000 ( 3.798138)
# second
# user system total real
# 3.530000 0.080000 3.610000 ( 3.618199)
# 3.540000 0.080000 3.620000 ( 3.631045)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment