[MacRuby] #1089: Performance: Regexp#match is slow.
MacRuby
ruby-noreply at macosforge.org
Thu Dec 30 19:56:37 PST 2010
#1089: Performance: Regexp#match is slow.
----------------------------------+-----------------------------------------
Reporter: watson1978@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
Test Script:
{{{
#!ruby
require 'benchmark'
Benchmark.bm do |x|
x.report {
1000.times do
sum = 0
1000.times do |i|
s = sprintf("%d", i)
/^10$/.match("100")
end
end
}
end
}}}
Result:
{{{
$ ruby -v bm_regexp.rb
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
user system total real
3.160000 0.000000 3.160000 ( 3.163137)
$ ruby19 -v bm_regexp.rb
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
user system total real
3.660000 0.010000 3.670000 ( 3.661313)
$ macruby05 -v bm_regexp.rb
MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64]
user system total real
16.290000 0.310000 16.600000 ( 12.663407)
$ macruby06 -v bm_regexp.rb
MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]
user system total real
28.040000 1.370000 29.410000 ( 23.561619)
$ macruby07 -v bm_regexp.rb
MacRuby 0.7 (ruby 1.9.2) [universal-darwin10.0, x86_64]
user system total real
26.260000 1.240000 27.500000 ( 21.986473)
$ macruby08 -v bm_regexp.rb
MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64]
user system total real
25.630000 1.250000 26.880000 ( 21.451434)
$ macruby -v bm_regexp.rb
MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64]
user system total real
22.690000 0.990000 23.680000 ( 18.992711)
}}}
In comparison with MacRuby 0.5, nearly 1.5 times is slow.
--
Ticket URL: <http://www.macruby.org/trac/ticket/1089>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list