evanphx / benchmark-ips

Provides iteration per second benchmarking for Ruby
MIT License
1.72k stars 97 forks source link

Accept symbol as report's argument. #26

Closed JuanitoFatas closed 9 years ago

JuanitoFatas commented 9 years ago

Now we could pass symbol to #report like the following :blush: :

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 } }
end
jemc commented 9 years ago

:+1: Just ran into this and was surprised it didn't work.

JuanitoFatas commented 9 years ago

:beers: