From: "M. Edward (Ed) Borasky" Date: 2007-10-28T04:31:15+09:00 Subject: Re: How fast does your Ruby run? Lionel Bouton wrote: > Daniel Sch�mer wrote: >> Gentoo Linux on Intel Pentium 4 2.40GHz (512 KB cache): >> >> Ruby Patch Platform Seconds Iterations per second >> ===== ===== =================== ========= ===================== >> 1.8.6 111 i686-linux (gentoo) 32.801483 30486 >> 1.8.6 5000 i686-linux 13.607635 73488 >> 1.9.0 0 i686-linux 3.988949 250692 >> 1.8.5 3876 java 63.589 15725 >> 1.8.5 3876 java (-J-server) 44.173 22638 >> 1.8.5 3876 java (-O) 36.917 27087 >> 1.8.5 3876 java (-O -J-server) 15.194 65815 >> >> The first is the system installed ruby. > > IIRC on my Gentoo I got +80% on this particular benchmark with > USE="-threads". Given this huge difference I looked at the speedup for > the test suite of one of my Rails applications and got only ~ +10%. > > That said I use Xpath in one Ruby script and the speedup was > unbelievable : maybe +1000% (yes 3 zeros, the script took more than a > minute, maybe several and with USE="-threads" it went through the data > in less than ten seconds). > I believe Ruby compiled with pthread is known to have performance > problems (at least on Linux as I've seen reports of such behavior on > Linux before)... > > If you want speed on Linux (and maybe other flavours of Unix), you > should look at compiling it without pthread. Warning: as some classes > may use system libs that *are* compiled with pthread, you might not have > this choice (IIRC the pthread support is there just to support such > libraries). > > If someone knows more about this subject (and how to tell if compiling > without pthread is safe), I'd love to know the details. > > Regards, > > Lionel > > Well, on Gentoo you'd need to turn off the "threads" USE flag globally. Either everything (in this case Ruby and Tcl/Tk for sure) is with "threads" or everything is without it. Personally, on my two UP systems (non-SMP) I turn it off and on my dual-core SMP system I turn it on. But that's really superstition more than anything based on measurements. I can't speak for other distros, Windows, Intel vs. AMD, etc. But as far as I know on Gentoo it's safe to go "-threads" across the board even on an SMP system. I'm going to go ahead and turn it off on the dual-core and see what happens -- I'm wrapping up some benchmarking tests this weekend so it's a good time to play around with it in a controlled environment.