about

rss

(cons 'ider 'this)

by Mark McGranaghan


## More Benchmark.nbmbm ##

Benchmark.nbmbm(100_000) do |x|
  ar = [1,2,3]
  
  x.report("each") do
    ar.each { |i| i * 1 }
  end
  
  x.report("loop") do
    i = 0
    while i < ar.size
      i * 1
      i += 1
    end
  end
end


# Abbreviated Results
           user     system      total        real
each   1.500000   0.680000   2.180000 (  2.179588)
loop   0.660000   0.160000   0.820000 (  0.820617)

<<