Skip to content

Instantly share code, notes, and snippets.

@sagmor
Created June 23, 2011 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sagmor/1041943 to your computer and use it in GitHub Desktop.
Save sagmor/1041943 to your computer and use it in GitHub Desktop.
Patched Ruby 1.9.2 for faster load and GC
# Ruby 1.9 Fast require:
# https://gist.github.com/1008945
curl https://raw.github.com/gist/1008945/7532898172cd9f03b4c0d0db145bc2440dcbb2f6/load.patch > load.patch
# Ruby 1.9.2 GC Patch:
# https://gist.github.com/856296
curl https://raw.github.com/gist/856296/a19ac26fe7412ef398bd9f57e61f06fef1f186fe/patch-1.9.2-gc.patch > gc.patch
rvm install 1.9.2-p180 --patch load.patch,gc.patch
rm gc.patch load.patch
# Config GC on RVM
# from http://metaskills.net/2011/03/09/gc-tune-ruby-1.9.2-with-rvm/
mkdir $rvm_path/hooks
cat <<EOF > $rvm_path/hooks/after_use
case "\$rvm_ruby_string" in
*ree*|*1.9.2-p180*)
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