Created
May 3, 2014 14:34
-
-
Save mame/2c1100664d452bff133a to your computer and use it in GitHub Desktop.
a micro benchmark for https://bugs.ruby-lang.org/issues/9508
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 "coverage.so" | |
Coverage.start | |
at_exit { p Coverage.result } |
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
30000000.times do | |
true ? false ? 1 : 2 : 3 | |
end |
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
# without the patch applied | |
$ time ./ruby -r./cov.rb -e 'require "./test"' | |
{"/home/mame/work/ruby/test.rb"=>[1, 30000000, nil]} | |
real 0m1.792s | |
user 0m1.784s | |
sys 0m0.008s | |
# with the patch applied | |
$ time ./ruby -r./cov.rb -e 'require "./test"' | |
{"/home/mame/work/ruby/test.rb"=>{:lines=>[1, 30000000, nil], :methods=>{}, :decisions=>{2=>[30000000, 30000000]}}} | |
real 0m4.066s | |
user 0m4.057s | |
sys 0m0.008s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment