public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
wycats (author)
Sun Jan 13 21:22:09 -0800 2008
commit  acef74f5e594c4140c5215b20edf29600745126e
tree    b3a011b14dca57494792637c131e7fa94597e12e
parent  86eef63c291eb02a236ee9f966aee55c0b0c21b0
merb-core / simple_benches / index.rb
100644 10 lines (8 sloc) 0.369 kb
1
2
3
4
5
6
7
8
9
10
require 'benchmark'
 
TIMES = (ARGV[0] || 100_000).to_i
 
Benchmark.bmbm do |x|
  x.report("'.' true") { TIMES.times { "Hello.Goodbye".index(".") }}
  x.report("/\./ true") { TIMES.times { "Hello.Goodbye".index(/\./) }}
  x.report("'.' false") { TIMES.times { "HellooGoodbye".index(".") }}
  x.report("/\./ false") { TIMES.times { "HellooGoodbye".index(/\./) }}
end