Today I decreased my Ruby On Rails boot time by ~60%, Yay!
(All credit goes to funny-falcon for the patches and Burke who posted the Gist)

I removed 26 gems from my Gemfile and I noticed a boost with a couple of seconds. From that I begun searching for large Gemfile problems and I stumbled on this gist https://gist.github.com/1688857

It a pretty long page, so I will just summarize how I got my 60%

I use ruby 1.9.3-p125 and rbenv and ruby-build for handling ruby.

First we need to create a manifest file for our new patched ruby

Create a file named ruby-1.9.3-perf with the following content

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
build_package_combined_patch() {
  local package_name="$1"
  {
    curl 'https://raw.github.com/gist/1859082/performance_and_backport_gc.patch' | patch -p1
    autoconf
    ./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS
    make -j 8
    make install
  } >&4 2>&1
}

require_gcc

install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz"
install_package "ruby-1.9.3-p125" "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz" combined_patch

When we have our manifest file in place we can use ruby-build to build ruby

1
ruby-build ./ruby-1.9.3-perf ~/.rbenv/versions/ruby-1.9.3-p125

And here is my final results!

1
2
3
4
5
6
7
8
9
10
11
12
13
Before

time -p bundle exec rake environment
  real 6.81
  user 5.93
  sys 0.85

After

time -p bundle exec rake environment
  real 3.75
  user 2.82
  sys 0.91

All credit goes to funny-falcon for the patches and Burke who posted the Gist.

Posted in Rails, Ruby at February 29th, 2012. 3 Comments
Tagged with , , , . Written by:

Today I got the chance to give Ruby Enterprise Edition a try. We are currently working with a really fun new environment and you do not get better opportunities to try new stuff as when you have a complete new environment thats not in production. So we gave REE a shoot. When compiling REE with got in trouble really fast and this post is about the quick fix to solve it and some of our early performance results.

Read More…

Posted in Hosting, Programming, Rails at December 15th, 2008. 9 Comments
Tagged with , , , , . Written by:

It's past my bedtime is using WP-Gravatar