How to install tcmalloc and speed up ruby

Use:

sudo apt-get install libgoogle-perftools-dev

then you can speed up your ruby by doing the following:

 export RUBY_GC_MALLOC_LIMIT=1000000000
 export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1.25
 export RUBY_HEAP_MIN_SLOTS=800000
 export RUBY_FREE_MIN=600000
 export LD_PRELOAD=/usr/lib/libtcmalloc_minimal.so.4
Advertisements

One thought on “How to install tcmalloc and speed up ruby

  1. the following didn’t help.
    export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1.25
    export RUBY_HEAP_MIN_SLOTS=800000
    export RUBY_FREE_MIN=600000
    also, RUBY_GC_MALLOC_LIMIT=1000000000 is too much

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s