Skip to content

Instantly share code, notes, and snippets.

@kyriacos
Created August 26, 2011 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyriacos/1173091 to your computer and use it in GitHub Desktop.
Save kyriacos/1173091 to your computer and use it in GitHub Desktop.
Patched Ruby 1.9.2 for faster load and GC
cd /tmp
# Faster require:
# https://gist.github.com/1008945
curl -O https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch
# GC-tuning:
# https://gist.github.com/856296
curl -O https://raw.github.com/gist/856296/a19ac26fe7412ef398bd9f57e61f06fef1f186fe/patch-1.9.2-gc.patch
rvm install 1.9.2 --patch /tmp/ruby-1.9.2p290.patch,/tmp/patch-1.9.2-gc.patch
rm /tmp/ruby-1.9.2p290.patch /tmp/patch-1.9.2-gc.patch
# GC-tune:
# http://metaskills.net/2011/03/09/gc-tune-ruby-1.9.2-with-rvm/
mkdir -p ~/.rvm/hooks
cat <<EOF > ~/.rvm/hooks/after_use
case "\$rvm_ruby_string" in
*ree*|*p290*)
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
export RUBY_FREE_MIN=$RUBY_HEAP_FREE_MIN
;;
*)
unset RUBY_HEAP_MIN_SLOTS RUBY_HEAP_SLOTS_INCREMENT RUBY_HEAP_SLOTS_GROWTH_FACTOR RUBY_GC_MALLOC_LIMIT RUBY_HEAP_FREE_MIN RUBY_FREE_MIN
;;
esac
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment