Created
September 20, 2017 09:03
-
-
Save sergey-chechaev/66822baba0b0ebd19540238877da1161 to your computer and use it in GitHub Desktop.
This file contains hidden or 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' | |
data = (0..50_000_000) | |
Benchmark.bm do |x| | |
x.report(:find) { data.find {|number| number > 40_000_000 } } | |
x.report(:bsearch) { data.bsearch {|number| number > 40_000_000 } } | |
end | |
user system total real | |
find 3.020000 0.010000 3.030000 (3.028417) | |
bsearch 0.000000 0.000000 0.000000 (0.000006) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment