Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tag: 1.3.0
Fetching contributors…

Cannot retrieve contributors at this time

11 lines (9 sloc) 0.41 kB
require 'benchmark'
Benchmark.bmbm do |bm|
bm.report("Control") { 10_000_000.times { 1 + 1 } }
bm.report("instance_eval a block") { 10_000_000.times { instance_eval { 1 + 1 } } }
if defined? instance_exec
bm.report("instance_exec a block") { 10_000_000.times { instance_exec { 1 + 1 } } }
end
bm.report("instance_eval a string (* 0.1 times)") { 1_000_000.times { instance_eval " 1 + 1 " } }
end
Jump to Line
Something went wrong with that request. Please try again.