Created
December 13, 2012 10:53
-
-
Save denyago/4275692 to your computer and use it in GitHub Desktop.
Compilation of performance of comparations
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
user system total real | |
Date 38.260000 0.290000 38.550000 ( 39.010656) | |
Bool 2.180000 0.000000 2.180000 ( 2.197462) | |
=> [ 38.260000 0.290000 38.550000 ( 39.010656) | |
, | |
2.180000 0.000000 2.180000 ( 2.197462) | |
] |
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' | |
DATE = ( Time.now - 1.months) | |
date_tnc = Time.now | |
t = (1.year * 0.667).to_i | |
Benchmark.bm do|b| | |
b.report("Compare Date") do | |
t.times { DATE < date_tnc } | |
end | |
b.report("Compare Bool") do | |
t.times { true == false } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment