Skip to content

Instantly share code, notes, and snippets.

@mame mame/cov.rb
Created May 3, 2014

Embed
What would you like to do?
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
You can’t perform that action at this time.