Skip to main content

Tuning Ruby for development

Ruby • Asked by Carl Mercier

What are you guys using these days to tune your Ruby MRI 2.5 at dev time? I've been using a mix of environment variables for a while and I'm not even sure if they're still valid, or deprecated.

Basically, I'm ok sacrificing ram for speed.

Here's what I have:

# Compile Ruby with jemalloc.

https://www.levups.com/en/blog/2017/optimize_ruby_memory_usage_jemalloc_heroku_scalingo.html

export RUBY_CONFIGURE_OPTS="--with-jemalloc --with-openssl-dir=/usr/local/opt/openssl"
export CONFIGURE_OPTS="--with-jemalloc --with-openssl-dir=/usr/local/opt/openssl"

Tune GC.

export RUBY_GC_HEAP_INIT_SLOTS=1000000 # 1M
export RUBY_GC_HEAP_FREE_SLOTS=500000 # 0.5M
export RUBY_GC_HEAP_GROWTH_FACTOR=1.1
export RUBY_GC_HEAP_GROWTH_MAX_SLOTS=10000000 # 10M
export RUBY_GC_MALLOC_LIMIT_MAX=1000000000 # 1G
export RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.1


I guess code blocks get confused with the hash symbol :) 

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.