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.
How:
install msysgit
c:> git://github.com/oneclick/rubyinstaller.git
cd rubyinstaller
set CCFLAGS=-DGC_MALLOC_LIMIT=60000000
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:
http://all.faithpromotingstories.org/ruby_distros/ruby19_mingw_44.tgz
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.

jruby bugs removed

for posterity sake, here’s the stuff i removed from the wiki:

====Under OSX I get this error when trying to execute jruby:  ”Exception in thread ‘main’ java.lang.NoClassDefFoundError: org/jruby/Main” ====
The source of this problem is the inclusion of <tt>’.'</tt> (current directory) in your $PATH. You’re also trying to execute JRuby from <tt>$JRUBY_HOME/bin</tt>. There’s a bug in the JRuby bash script that prevents this from working.
To correct the issue, remove <tt>’.'</tt> from your $PATH and relaunch the shell. Alternately, if you really want to keep <tt>’.'</tt> in your $PATH (which you shouldn’t, but see google for reasons why), then just change your working directory to something other than <tt>$JRUBY_HOME/bin</tt> and execute the <tt>jruby</tt> command. It should launch just fine.
% cd /any/path/other/than/jruby_home
% jruby # should work
”’Note:”” This bug has been fixed in JRuby 1.2.

====Under OSX I get this error when trying to execute jruby:  ”Exception in thread ‘main’ java.lang.NoClassDefFoundError: org/jruby/Main” ====The source of this problem is the inclusion of <tt>’.'</tt> (current directory) in your $PATH. You’re also trying to execute JRuby from <tt>$JRUBY_HOME/bin</tt>. There’s a bug in the JRuby bash script that prevents this from working.
To correct the issue, remove <tt>’.'</tt> from your $PATH and relaunch the shell. Alternately, if you really want to keep <tt>’.'</tt> in your $PATH (which you shouldn’t, but see google for reasons why), then just change your working directory to something other than <tt>$JRUBY_HOME/bin</tt> and execute the <tt>jruby</tt> command. It should launch just fine.  % cd /any/path/other/than/jruby_home  % jruby # should work
”’Note:”” This bug has been fixed in JRuby 1.2.

jruby jframe image

Here it is:

require’java’
module M
include_package “javax.swing”
include_package “javax.awt”
include_package “javax.net”
class ShowImage < JFrame
def initialize
@img= java.awt.Toolkit.getDefaultToolkit().getImage(“c:/dev/ruby/johnpack1.jpg”)
end
def paint(g)
g.drawImage(@img,Time.now.to_f % 100,20,self)
end
end
end
frame = M::ShowImage.new
frame.setSize(200,200)
frame.defaultCloseOperation = M::JFrame::EXIT_ON_CLOSE
frame.visible=true

rmagick collage

Here’s how to combine two images into one (a “collage”)

require ‘rubygems’
require ‘RMagick’
include Magick
image_name = ‘johnpack1.jpg’
image_1 = Image.read(image_name).first
image_2 = Image.read(image_name).first
image_2.crop_resized!(10,10)
image_1.composite!(image_2, 1 * 100 + rand(15), 150 + rand(15), OverCompositeOp)
image_1.write(‘collage.jpg’)

require ‘rubygems’require ‘RMagick’include Magick
image_name = ‘johnpack1.jpg’
image_1 = Image.read(image_name).firstimage_2 = Image.read(image_name).first
image_2.crop_resized!(10,10)
image_1.composite!(image_2, 1 * 100 + rand(15), 150 + rand(15), OverCompositeOp)image_1.write(‘collage.jpg’)

ref:

http://weare.buildingsky.net/2006/10/18/render-greatlooking-collages-with-ruby-and-rmagick

vlc build woes

CC     liblua_plugin_la-net.lo
libs/net.c: In function ‘vlclua_fd_write’:
libs/net.c:249:5: error: implicit declaration of function ‘write’
libs/net.c: In function ‘vlclua_fd_read’:
libs/net.c:259:5: error: implicit declaration of function ‘read’
make[6]: *** [liblua_plugin_la-net.lo] Error 1
make[6]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc/lua’
make[5]: *** [all] Error 2
make[5]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc/lua’
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc’
make[3]: *** [all] Error 2
make[3]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc’
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc’
make: *** [all] Error 2

CC     liblua_plugin_la-net.lolibs/net.c: In function ‘vlclua_fd_write’:libs/net.c:249:5: error: implicit declaration of function ‘write’libs/net.c: In function ‘vlclua_fd_read’:libs/net.c:259:5: error: implicit declaration of function ‘read’make[6]: *** [liblua_plugin_la-net.lo] Error 1make[6]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc/lua’make[5]: *** [all] Error 2make[5]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc/lua’make[4]: *** [all-recursive] Error 1make[4]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc’make[3]: *** [all] Error 2make[3]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules/misc’make[2]: *** [all-recursive] Error 1make[2]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc/modules’make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/c/dev/ruby/downloads/juhovh_vlc’make: *** [all] Error 2

meant “disable lua–something is not quite right in there [mingw videolan]“