Skip to content

Instantly share code, notes, and snippets.

@DefV
Created September 9, 2014 10:17
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 DefV/0aed42d496e5ff93a964 to your computer and use it in GitHub Desktop.
Save DefV/0aed42d496e5ff93a964 to your computer and use it in GitHub Desktop.
Bench
require 'benchmark'
n = 100_000_000
Benchmark.bm do |x|
x.report do
result = []
row = nil
n.times do |i|
row = i * 5
result << row
end
end
x.report do
result = []
n.times do |i|
row = i * 5
result << row
end
end
end
user system total real
7.510000 0.220000 7.730000 ( 7.794392)
7.550000 0.210000 7.760000 ( 7.765262)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment