From: Jon Date: 2009-08-19T01:43:29+09:00 Subject: [ruby-core:24968] Re: 1.9 gem env is far slower than on 1.8? > > Currently when I run "gem env" on a windows machine > > > > with 1.8.6 it takes [~80 gems installed] > > > > real �� ��0m0.360s > > > > with 1.9.1 [~80 gems] > > > > real �� ��0m1.610s > > > > with 1.9.2 [~40 gems] > > > > real �� ��0m1.140s > > > > [all with 1.3.5 installed] > > > > Not so for Linux--1.9.2 seems slightly faster than 1.8.6 for its gem list. > > > > Anybody have any inkling as to what's going on here? > > Thanks! > I guess the slowdown is due to the following lines from io.c > > #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32) > /* Windows */ > # define NEED_NEWLINE_DECORATOR_ON_READ(fptr) (!(fptr->mode & FMODE_BINMODE)) > # define NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) (!(fptr->mode & FMODE_BINMODE)) > # define TEXTMODE_NEWLINE_DECORATOR_ON_WRITE ECONV_CRLF_NEWLINE_DECORATOR > #else > /* Unix */ > # define NEED_NEWLINE_DECORATOR_ON_READ(fptr) (fptr->mode & FMODE_TEXTMODE) > # define NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) 0 > #endif > > On windows, default mode regarded as text mode and > NEED_NEWLINE_DECORATOR_ON_READ is set. On the contrary, on Linux, > default mode regarded as binary mode and > NEED_NEWLINE_DECORATOR_ON_READ is not set. > > > Regards, > > Park Heesob I'm a bit surprised that this post hasn't generated more interest. Has anyone done any rough performance testing to see what the impact of NEED_NEWLINE_DECORATOR_ON_READ on Windows is? After reading that "...Ruby 1.9.1 on Linux is about 70% faster than the Windows version" from http://antoniocangiano.com/2009/08/10/how-much-faster-is-ruby-on-linux/ and seeing some truly awful numbers (e.g. - bm_so_count_words.rb of 3.741 vs 31.031) as well as seeing some of my IO-based spec runs take considerably longer on 1.9.1, I'd like to better understand the issues. However, it's not clear from this post were the issue might be. Is it a core implementation issue? Is it a RubyGems implementation issue? Is it just a fact of life of having 0x0D's in files? I'm new to the codebase but am planning to find time to do the following investigation on my Windows box. If anyone more experienced would care to point out some of the expected problems before I dive down the rabbit hole, I'd appreciate it: 1) Download ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz 2) Forceably disable macro via #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32) /* Windows */ # define NEED_NEWLINE_DECORATOR_ON_READ(fptr) 0 3) Compile with MSys/MinGW 4.4.0 using ./configure --prefix=/e/ruby19 --disable-pthread --enable-shared --disable-install-doc make make install 4) Ensure all .rb files in this Ruby installation use Unix line endings 5) Pull http://github.com/acangiano/ruby-benchmark-suite/tree/master and ensure all files use Unix line endings. 6) Steal any missing .dll's or .so's from http://rubyinstaller.org/ to make things work 7) Disable RubyGems custome require in order to take RubyGems out of the picture. 8) Try to run the benchmarks and my specs ensuring all specs hav Does this even have a hope of working? Or is segfaults and other fun things expected to happen? Thanks, Jon