Created
October 19, 2008 05:18
-
-
Save wmoxam/17783 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
rb(main):008:0> a = 0 | |
=> 0 | |
irb(main):009:0> b = 1 | |
=> 1 | |
irb(main):010:0> Benchmark.bm {|x| x.report { 100000.times { a.zero? } } } | |
user system total real | |
0.030000 0.000000 0.030000 ( 0.020547) | |
=> true | |
irb(main):011:0> Benchmark.bm {|x| x.report { 100000.times { b.zero? } } } | |
user system total real | |
0.020000 0.010000 0.030000 ( 0.023609) | |
=> true | |
irb(main):012:0> Benchmark.bm {|x| x.report { 100000.times { a == 0 } } } | |
user system total real | |
0.040000 0.000000 0.040000 ( 0.035733) | |
=> true | |
irb(main):013:0> Benchmark.bm {|x| x.report { 100000.times { b == 0 } } } | |
user system total real | |
0.030000 0.000000 0.030000 ( 0.027180) | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment