/gist:91ebcb535f73ef2de412 Secret
Created
March 5, 2013 15:08
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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