Hi,
I found that recently released ruby 1.6.8 from the
distribution from The Pragmatic Programmers (not to blame them)
is MUCH slower in my IO-processing scripts than their previous
ruby 1.6.5. I figured out that 1.6.5 was based on cygwin
while 1.6.8 is “native” mswin32.
Here is the simple test and results:
$ cat io_test.rb
f=open(ARGV[0],“r”)
f.binmode
slice=1024*1024
while true
s=f.read(slice)
if s==nil
break
end
end
puts f.tell
f.close
$ ruby -v
ruby 1.6.5 (2001-09-19) [i386-cygwin]
$ time ruby io_test.rb mpich.tar.gz
12313304
real 0m0.441s
user 0m0.020s
sys 0m0.000s
$ /cygdrive/d/Programs/ruby/bin/ruby -v
ruby 1.6.8 (2002-12-24) [i586-mswin32]
$ time /cygdrive/d/Programs/ruby/bin/ruby io_test.rb mpich.tar.gz
12313304
real 0m34.129s
user 0m0.010s
sys 0m0.010s
So “proccessing” of file ~12Mb takes 0.5 and 30 seconds!
What could be a reason of such a slowness of mswin32-ruby?