Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

12 lines (10 sloc) 0.382 kb
require 'benchmark'
(ARGV[0] || 10).to_i.times do
method = method(:to_s)
method_proc = method.to_proc
Benchmark.bm(30) do |bm|
bm.report("control, 1000k to_s calls") { 1000000.times { to_s } }
bm.report("Method.call, 1000k calls") { 1000000.times { method.call } }
bm.report("to_proc'ed Method.call, 1000k calls") { 1000000.times { method_proc.call } }
end
end
Jump to Line
Something went wrong with that request. Please try again.