Skip to content

Instantly share code, notes, and snippets.

@mame
Created May 3, 2014 14:34
Show Gist options
  • Save mame/2c1100664d452bff133a to your computer and use it in GitHub Desktop.
Save mame/2c1100664d452bff133a to your computer and use it in GitHub Desktop.
require "coverage.so"
Coverage.start
at_exit { p Coverage.result }
30000000.times do
true ? false ? 1 : 2 : 3
end
# 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