Module: Benchmark


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. require 'benchmark' n = 50000 Benchmark.bm do |x| x.report { for i in 1..n; a = "1"; end } x.report { n.times do ; a = "1"; end } x.report { 1.upto(n) do ; a = "1"; end } end

URL: http://www.ruby-doc.org/core/classes/Benchmark.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.