[MacRuby] #1408: MacRuby is slow when passed a Regexp's object into argument of method.

MacRuby ruby-noreply at macosforge.org
Sat Oct 15 21:39:26 PDT 2011


#1408: MacRuby is slow when passed a Regexp's object into argument of method.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 require 'benchmark'

 def scan(pattern)
 end

 Benchmark.bm(10) do |x|
   reg = Regexp.new(".")
   str = "."
   x.report "regexp" do
     scan(reg)
   end

   x.report "string" do
     scan(str)
   end
 end
 }}}

 Result:
 {{{
 $ macruby t.rb
                 user     system      total        real
 regexp      0.000000   0.000000   0.000000 (  0.001560)
 string      0.000000   0.000000   0.000000 (  0.000008)

 $ ruby19 -v t.rb
 ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
                 user     system      total        real
 regexp      0.000000   0.000000   0.000000 (  0.000010)
 string      0.000000   0.000000   0.000000 (  0.000005)

 $ ruby -v t.rb
 ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
                 user     system      total        real
 regexp      0.000000   0.000000   0.000000 (  0.000009)
 string      0.000000   0.000000   0.000000 (  0.000006)
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1408>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list