From: Robert Klemme Date: 2010-02-06T22:45:05+09:00 Subject: Re: Bug: Ruby 1.9.1 File io on Windows is slooooow On 02/05/2010 10:53 PM, Ad Gr wrote: > Roger Pack wrote: >>> ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32] >>> "2 40.188834" >>> >>> ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] >>> "2 0.087" >>> >>> That is about 5x slower write and 500x read operation. Times are the >>> same if I do: >>> f = File.new('out.file','r') >>> c = f.read >>> f.close >>> P.S. >>> Where can I officaly report a Ruby bug? >> Looks like this bug is http://redmine.ruby-lang.org/issues/show/1332 >> Can you try with mode 'rb' and is it fast then? >> -r > > Also this one is much much slower on ruby 1.9 then on ruby 1.8: > Tested on Windows XP. No virus scanner. > > time = [Time.new] > n = 1000 > lines = [] > (1..n).each { |nr| lines << "line" } > > time << Time.new > File.open('out2.file','w') { |f| > lines.each { |l| > f.print(l) > f.flush > } > } > time << Time.new > > txt = ['construct','write','read'] > 0.upto(time.size - 2) {|i| p "#{txt[i]} #{time[i+1]-time[i]}" } > > > #ruby 1.9 > #"construct 0.0" > #"write 22.453125" > > #ruby 1.8 > #"construct 0.0" > #"write 0.015" How many test runs did you do? Because of caching figures from a single run are usually not very telling. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/