Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'benchmark/ips'
class Foo
define_method("foo") { }
class_eval 'def bar; end'
end
Benchmark.ips do |x|
foo = Foo.new
x.report("class_eval") { foo.bar }
x.report("define_method") { foo.foo }
end
class_eval 6874955.4 (±1.0%) i/s - 34395821 in 5.003561s (cycle=205963)
define_method 6187071.9 (±1.7%) i/s - 30989768 in 5.010413s (cycle=289624)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.