From: Juergen Strobel Date: 2006-05-25T23:45:32+09:00 Subject: Re: How to Improve Performance Now. Re: Zed and Luis drop the bomb onRuby's poor performance On Tue, May 23, 2006 at 10:18:10AM +0900, John Carter wrote: > > Simple way number one. > > Currently Ruby is compiled -O2 usually for generic i386 > > Obvious answers > - Compile -O3, gcc, especially since version 4.0 has grown some really > nifty > optimizations. Almost the whole point of version gcc 4 > > - Compile -march=pentium4, or -march=k7 or whatever the machine it's > actually running on is. This gives you... > - Tuned for the pipeline of that CPU. > - Uses the new fancy instructions for that CPU. > > - gcc has / is growing profile based branch prediction. This is something > ideal for an interpreted language with a largish test suite! > > > Not quite so easy answers... > > Use gprof to get some profile data. > > * Use inline functions. C++ and STL have forced all compilers today to > be very very Good with inline functions. In several respects inlines are > better than macros. > > * const and pure attributes can speed things up too. > ... There are big problems with this approach. None of gcc's optimizations beyond -O2 come for free. They usually enlarge the binary, make debugging really hard, impact thread-safeness or even correct functionality (omit frame pointer). The reason those switches are not standard is because they are not beneficial in all cases, and sometimes decidedly worse than -O2. Since especially distributors don't know the exact circumstances ruby will be deployed in, it is better for them to play safe. Reworking ruby for better alignment of memory accesses might be useful. After determining how much of a problem it is though. J�rgen -- The box said it requires Windows 95 or better so I installed Linux