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:
Fastest way to do .index
wycats (author)
Sun Jan 13 21:22:09 -0800 2008
commit  acef74f5e594c4140c5215b20edf29600745126e
tree    b3a011b14dca57494792637c131e7fa94597e12e
parent  86eef63c291eb02a236ee9f966aee55c0b0c21b0
...
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
0
@@ -1 +1,11 @@
0
+require 'benchmark'
0
+
0
+TIMES = (ARGV[0] || 100_000).to_i
0
+
0
+Benchmark.bmbm do |x|
0
+ x.report("'.' true") { TIMES.times { "Hello.Goodbye".index(".") }}
0
+ x.report("/\./ true") { TIMES.times { "Hello.Goodbye".index(/\./) }}
0
+ x.report("'.' false") { TIMES.times { "HellooGoodbye".index(".") }}
0
+ x.report("/\./ false") { TIMES.times { "HellooGoodbye".index(/\./) }}
0
+end

Comments

    No one has commented yet.