[MacRuby] #1142: Array#pack performance while converting array of ASCII values to string

MacRuby ruby-noreply at macosforge.org
Mon Jan 31 14:08:12 PST 2011


#1142: Array#pack performance while converting array of ASCII values to string
------------------------------------------+---------------------------------
 Reporter:  justin@…                      |       Owner:  lsansonetti@…        
     Type:  defect                        |      Status:  new                  
 Priority:  major                         |   Milestone:                       
Component:  MacRuby                       |    Keywords:                       
------------------------------------------+---------------------------------
 It takes MacRuby over 1600x longer than CRuby 1.9.2 to convert an array of
 ASCII characters to a 1MB string using Array#pack.

 Simular to ticket 1136:
 https://www.macruby.org/trac/ticket/1136

 Using MacRuby r5214 that includes the fix from ticket 1136.

 test.rb:
 {{{
 require 'benchmark'

 ary = Array.new(1024*1024,0)
 ret = Benchmark.measure do
   ary.pack('C*')
 end
 puts ret
 }}}

 benchmarks:
 {{{
 ~ > ruby ./test.rb
   0.040000   0.000000   0.040000 (  0.043437)
 ~ > macruby ./test.rb
  87.690000  26.300000 113.990000 ( 69.515317)
 }}}

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



More information about the macruby-tickets mailing list