> My key concern is http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/24968 > > I'm not yet clear as to the root cause. For example, is this #ifdef "fixable" for Windows due to implementation specifics of MRI's IO, or is it a consequence of needing to handle Windows CRLF and not a weakness in the current implementation? The "first" cause is that realloc in msvcrt.dll is for some reason *very slow* -- at least with msvcrt6 Combine that with the fact that the read buffer size on descriptors in mingw (or possibly windows itself) defaults to a very small value, and that ruby by default reads only that much and resizes strings to become that size, and you have the problem. I did some work on this: http://redmine.ruby-lang.org/issues/show/2742 (hopefully somebody will look at my patches sometime). Those patches speed up some reads by performing fewer realloc's, but aren't the "best" way. The best way, (on windows) would be to avoid realloc's if at all possible (or put them off until the very end). Then ruby would probably read pretty fast. Jruby probably doesn't use realloc this way, and probably doesn't have the same speed problem. There is a smaller problem after that one, too. If you're reading in ascii mode (the default in windows), it does a full scale encoding translation of incoming bytes before passing them back to you. The good news is that this is only like 50x slower than a normal read, so might be bearable. It could use some optimization, I haven't looked at it much. You can work around that one by doing something like # instead of a = File.read 'abc' # do this a = File.binread('abc').gsub!("\r\n", "\n") which is many times faster (but loses encoding coolness, if you needed that). Ruby could be optimized a bit in that regard. Jruby doesn't do any 1.9 encoding support (that I'm aware), so again probably doesn't exhibit this, at least won't until they add encoding support and you run it in 1.9 mode, then it might. HTH. -rp > Are *nix systems able to IO optimize for this case while Windows systems cannot? ЁВфитебупо фийу ретжптнбогдемфйуо§уеео йо КТхвщЫ±Э йу фибф фиКЦН§гтпуурмбфжптн ЙП ибодмйоз бмчбщу ибфп ибодме впфи гбуебофиетежптгбо§жхммпрфйнйъе жппормбфжптнй®е® бмрбфиртйгеї