Bug #1332
closedReading file on Windows is 500x slower then with previous Ruby version
Description
=begin
time = [Time.new]
c = ''
'aaaa'.upto('zzzz') {|e| c << e}
3.times { c << c }
time << Time.new
File.open('out.file','w') { |f| f.write(c) }
time << Time.new
c = File.open('out.file','r') { |f| f.read }
time << Time.new
0.upto(time.size - 2) {|i| p "#{i} #{time[i+1]-time[i]}" }
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
"0 0.537075"
"1 0.696244"
"2 40.188834"
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
"0 0.551"
"1 0.133"
"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
Tried on two machines. Vista SP1 and XP SP3. Same results.
Tried with virus scanner disabled. Same results.
Tried on old Win2K P4 2.4Ghz machine without virus scanner
"0 1.0625"
"1 1.09375"
"2 111.171875"
Thats 111 seconds to read 14.623.232 bytes long file which is probably read from cache anyway.
The problem doesn't seem to exist on Linux althow I have tried only Ruby 1.9.0 version.
by
TheR
=end