Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

14 lines (10 sloc) 0.345 kB
require 'benchmark'
n = 50000
Benchmark.bm(7) do |x|
x.report("for:") { for i in 1..n; a = "1"; end }
x.report("times:") { n.times do ; a = "1"; end }
x.report("upto:") { 1.upto(n) do ; a = "1"; end }
end
Benchmark.measure('test'){
for i in 1..n; a = "1"; end
}.format("%10.6u %10.6y %10.6t %10.6r %n\n")
Jump to Line
Something went wrong with that request. Please try again.