Tuning your Ruby GC for fun and profit

By simply adding the following to my .zshrc:

export RUBY_HEAP_MIN_SLOTS=2000000
export RUBY_HEAP_SLOTS_INCREMENT=500000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=70000000
export RUBY_FREE_MIN=100000

I'm getting a 10% increase running the test suite on a Rails app:

# Before:
rake  24.57s user 3.77s system 95% cpu 29.690 total
# After:
rake  21.41s user 4.22s system 95% cpu 26.897 total

Try it out and see it for yourself :)

5 comments:

  1. BTW: RUBY_HEAP_FREE_MIN doesn't exist as of 2.0, it's RUBY_FREE_MIN now.

    ReplyDelete
    Replies
    1. You're right: http://stackoverflow.com/a/16304076/687355
      I'll update the post to reflect all this, thanks a lot! :)

      Delete
  2. In Ruby 1.9.3/2.0.0 (as of p247), only RUBY_GC_MALLOC_LIMIT, RUBY_HEAP_MIN_SLOTS, and RUBY_FREE_MIN are available. Ruby trunk/master includes RUBY_HEAP_SLOTS_GROWTH_FACTOR. No (unpatched) version of Ruby contains the RUBY_HEAP_SLOTS_INCREMENT setting.

    ReplyDelete
  3. I’m trampled by your contents carry on the wonderful work.
    Social Media Marketing

    ReplyDelete
  4. Remarkable blog! I have no words to praise, it has really allured me.
    Sex Toys

    ReplyDelete