Skip to content

Instantly share code, notes, and snippets.

@dx7
Forked from rodrigotassinari/gist:1078666
Created July 15, 2011 02:03
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 dx7/1083894 to your computer and use it in GitHub Desktop.
Save dx7/1083894 to your computer and use it in GitHub Desktop.
Patched Ruby 1.9.2 for faster load and GC
# Just run:
# bash < <(curl -Ls https://raw.github.com/gist/1083894)
# Update and cleanup RVM
rvm get head
rvm reload
rvm cleanup all
# Ruby 1.9 Fast require:
# https://gist.github.com/1008945
curl -L https://raw.github.com/gist/1008945 > /tmp/load.patch
# Ruby 1.9.2 GC Patch:
# https://gist.github.com/856296
curl -L https://raw.github.com/gist/856296 > /tmp/gc.patch
rvm install 1.9.2-p180 --patch /tmp/load.patch,/tmp/gc.patch -n loadgc
rm /tmp/gc.patch /tmp/load.patch
# Config GC on RVM
# from 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*|*loadgc*)
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
rvm cleanup all
rvm reload
echo "Have Fun!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment