Thoughts and tutorials on programming

Wednesday, August 05, 2009

how to compile ruby with increased garbage size

You may have noticed when you're running long-ish rails processes in windows that it sometimes pauses briefly, then continues on its merry way.

I have, at least.

The problem can be attributed to the garbage collector.
Ex: with one operation large_table.find(:all).each{||...}

I would receive something like 10 0.10 second pauses before it finished--increasing my overall time by at least 25%

Tweaking the malloc limit [the amount it will grow before doing a GC limit] changed that to something like 2 0.25 second pauses--which caused things to speedup considerably.

install msysgit
c:> git://
cd rubyinstaller
rake # build ruby 1.8 in sandbox/ruby18_mingw
rake ruby19 # build ruby 1.9 in sandbox/ruby19_mingw

Installers hopefully coming soon.

Another option for speeding things up is building with GCC 4.4 instead of the 3.4.5 currently used.
Here's a download that does that for the adventurous:

Anyway, watch this area as I'll post various ruby executables with different (faster) compiler options, and experimental like using tcmalloc, etc.
Thanks and good luck to all your windows+ruby users (like myself) out there!

Also much thanks to Luis and the one click group for making it possible to use these cool tools.


No comments: