Created
April 1, 2016 22:36
-
-
Save tenderlove/745c266b79882739a956d6d755de58c4 to your computer and use it in GitHub Desktop.
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 | |
def bar; end | |
end | |
def ic_hit obj | |
obj.bar | |
end | |
z = Benchmark.ips do |x| | |
10.times do |i| | |
x.report "singleton #{i}" do | |
foo = Foo.new | |
foo.singleton_class | |
ic_hit foo | |
end | |
end | |
end | |
print "ips," | |
puts z.entries.map(&:ips).join(",") | |
print "stddev," | |
puts z.entries.map(&:ips_sd).join(",") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment