Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
10 lines (7 sloc) 233 Bytes
require 'benchmark/ips'
data = [*0..100_000_000]
Benchmark.ips do |x|
x.report('find') { data.find { |number| number > 77_777_777 } }
x.report('bsearch') { data.bsearch { |number| number > 77_777_777 } }
x.compare!
end
You can’t perform that action at this time.