Skip to content

Instantly share code, notes, and snippets.

@div
Forked from sj26/0-readme.md
Created October 3, 2012 09:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save div/3826116 to your computer and use it in GitHub Desktop.
Save div/3826116 to your computer and use it in GitHub Desktop.
ruby-1.9.3-p327 cumulative performance patch.

Patched ruby 1.9.3-p327 for 30% faster rails boot + with support of utf-8 console input

What is?

This script installs a patched version of ruby 1.9.3-p327 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

What I need?

  • rbenv
  • ruby-build

OR

  • rvm

How do I do?

brew install autoconf
brew install readline

Check that directory: brew --prefix readline really exists.

brew tap homebrew/dupes
brew install apple-gcc42

If you're using rbenv:

curl https://raw.github.com/gist/3826116/rbenv.sh | sh && rbenv global 1.9.3-p327-perf

If you're using rvm:

rvm get head && rvm reinstall 1.9.3-perf --patch falcon

BONUS!

Putting the following in your shell config (eg. ~/.bash_profile) will make Rails even faster, but will increase its memory footprint:

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
VERSION="1.9.3-p327"
curl https://raw.github.com/gist/1688857/2-$VERSION-patched.sh > /tmp/$VERSION-perf
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" rbenv install /tmp/$VERSION-perf
@div
Copy link
Author

div commented Oct 3, 2012

Results of time (rails runner "puts 'hello world'")
before: 10.15s user 1.75s system 89% cpu 13.256 total
after: 5.18s user 1.55s system 83% cpu 8.092 total

@div
Copy link
Author

div commented Oct 31, 2012

p286 results
time ( rails runner "puts 'hello world'"; )
before: 3.74s user 0.82s system 83% cpu 5.476 total
after: 2.28s user 0.71s system 85% cpu 3.496 total

@div
Copy link
Author

div commented Oct 31, 2012

And to compare with p194 on the same project
before: 4.80s user 0.92s system 87% cpu 6.555 total
after: 2.73s user 0.83s system 82% cpu 4.299 total

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment