Created
August 2, 2011 17:46
-
-
Save jswanner/1120753 to your computer and use it in GitHub Desktop.
How to patch ruby for GC tuning and faster requiring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case "$rvm_ruby_string" in | |
*ruby-1.9.2*-patched) | |
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 | |
# To use this hook for REE, replace line 2 with the following: | |
# *ree*|*ruby-1.9.2*-patched) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://raw.github.com/gist/856296/patch-1.9.2-gc.patch > ~/192-gc.patch | |
curl https://raw.github.com/gist/1008945/load.patch > ~/192-load.patch | |
rvm get head | |
rvm reload | |
# create ruby called: ruby-1.9.2-p180-patched | |
rvm install ruby-1.9.2-p180 --patch ~/192-gc.patch --patch ~/192-load.patch -n patched | |
# create after_use hook to set desired ENV variables | |
curl https://raw.github.com/gist/1120753/after_use_192-patched.sh > $rvm_path/hooks/after_use_192-patched | |
chmod u+x $rvm_path/hooks/after_use_192-patched | |
rm ~/192-gc.patch ~/192-load.patch |
The way this is written you will have a ruby version ending with "-patched", so you'll have to modify your .rvmrc files to use it. If you want to just patch the "standard" ruby version and not have a version called "xxx-patched": leave the -n patched
option off of the rvm install
command, and modify the after_use hook appropriately
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl https://raw.github.com/gist/1120753/install.sh | sh