From: Nobuyoshi Nakada Date: 2002-03-08T09:22:16+09:00 Subject: Re: file reading impossibly slow? 1.6.6 vs. 1.6.2 numbers Hi, At Fri, 8 Mar 2002 08:59:23 +0900, Matt Armstrong wrote: > >>Yes, the slow IO for the native Win32 version of Ruby 1.6 is quickly > >>becoming a FAQ on this list. This is the third time it has come up in > >>recent memory. :-) > > > > I missed the first two, but having recently installed the 1.6.6 > > version I was amazed at the difference. I don't think it is > > something that 1.7 or 1.8 will solve, unless they are using > > completely different file system calls. I think it is likely to have > > something to do with the way 1.6.6 is built in Visual C++ and/or the > > fact that we have to use different file system calls to get good > > performance under mswin (if this is the case then cygwin version > > must be doing somethin under the covers to invoke different file > > system calls). > > The 1.6.6, the Win32 IO was just written very inefficiently. It ends > up reading one byte at a time from the OS. The "unix" version reads > them in bigger chunks, and so both unix and cygwin run much better. The reasons of IO slowness, of 1.6 and of Win32, are differ. Former is as you described above and for all platforms, and latter is due to signal handling for Win32. $ time ./1.6/i686-linux/miniruby -e '1000.times{STDIN.read(102400)}' < /dev/zero real 0m18.697s user 0m17.560s sys 0m1.010s $ time ./1.7/i686-linux/miniruby -e '1000.times{STDIN.read(102400)}' < /dev/zero real 0m1.371s user 0m0.370s sys 0m0.970s > 1.7 has already been fixed to read data in bigger chunks. In 1.7, IO > efficiency is about the same for both Win32 and Unix. Yes, and signal handling under Win32 is also improved in 1.7. -- Nobu Nakada