[MacRuby] #1100: Performance: File#read with huge file is slow.

MacRuby ruby-noreply at macosforge.org
Tue Jan 4 16:31:18 PST 2011


#1100: Performance: File#read with huge file is slow.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 require 'benchmark'

 Benchmark.bm(10) do |x|
   5.times do |i|
     i = (i + 1) * 10
     File.open("bm_#{i}m.txt", "w") {|f|
       f.write "x" * i * 1024 * 1024
     }

     x.report("size = #{i}M") {
       10.times do
         File.open("bm_#{i}m.txt") {|f|
           f.read
         }
       end
     }
   end
 end
 }}}

 Result with CRuby 1.8:
 {{{
 $ ruby bm_fread.rb
                 user     system      total        real
 size = 10M  0.060000   0.130000   0.190000 (  0.211715)
 size = 20M  0.140000   0.290000   0.430000 (  0.459126)
 size = 30M  0.200000   0.410000   0.610000 (  0.634365)
 size = 40M  0.260000   0.560000   0.820000 (  0.828851)
 size = 50M  0.330000   0.690000   1.020000 (  1.029419)
 }}}

 Result with MacRuby latest:
 {{{
 $ macruby bm_fread.rb
                 user     system      total        real
 size = 10M  0.980000   0.450000   1.430000 (  0.912856)
 size = 20M  2.020000   0.870000   2.890000 (  2.176286)
 size = 30M  3.170000   1.820000   4.990000 (  3.616632)
 size = 40M  3.870000   0.900000   4.770000 (  2.808244)
 size = 50M  7.250000   2.960000  10.210000 ( 49.571520)
 }}}

 From the stage that used up memory of my machine, it becomes late rapidly.
 [[BR]]
 It became late at a stage of 5M with another machine.

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



More information about the macruby-tickets mailing list