Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Last active December 15, 2015 23:49
Show Gist options
  • Save kenmazaika/5342786 to your computer and use it in GitHub Desktop.
Save kenmazaika/5342786 to your computer and use it in GitHub Desktop.
export RUBY_HEAP_MIN_SLOTS=600000
export RUBY_GC_MALLOC_LIMIT=59000000
export RUBY_HEAP_FREE_MIN=100000

Step 1 - Garbage Collection Tuning

Add the following to your .bash_profile. It's based off the 37 signals REE tuning.

# Ruby GC Tuning
export RUBY_HEAP_MIN_SLOTS=600000
export RUBY_GC_MALLOC_LIMIT=59000000
export RUBY_HEAP_FREE_MIN=100000

No Optimization

Units:       Finished tests in 439.690378s, 3.1568 tests/s, 9.5522 assertions/s.
Functionals: Finished tests in 445.060007s, 1.5616 tests/s, 4.8151 assertions/s.

Before: 884.750385 seconds

GC Optimizations

Units:       Finished tests in 391.271548s, 3.5474 tests/s, 10.7342 assertions/s.
Functionals: Finished tests in 307.495845s, 2.2602 tests/s, 6.9692 assertions/s.

After: 698.767393

185.982 seconds OR 3.09 minutes faster

~ 20% Faster

Unoptimized: http://ken.ht/unit-test-profiles
Test Optimization: Run Rake with GC flag optimizations stolen from 37 signals.
RUBY_HEAP_MIN_SLOTS=600000 RUBY_GC_MALLOC_LIMIT=59000000 RUBY_HEAP_FREE_MIN=100000
No Optimization
Units: Finished tests in 439.690378s, 3.1568 tests/s, 9.5522 assertions/s.
Functionals: Finished tests in 445.060007s, 1.5616 tests/s, 4.8151 assertions/s.
= before: 884.750385
GC Optimizations no profiling:
Finished tests in 391.271548s, 3.5474 tests/s, 10.7342 assertions/s.
Finished tests in 307.495845s, 2.2602 tests/s, 6.9692 assertions/s.
= after: 698.767393
http://ken.ht/unit-test-profiles-optimized-gc
185.98299200000008s faster, 3.0997165333333347 minutes
20% faster
@kenmazaika
Copy link
Author

:neckbeard: 👔 🐺 :shipit:

Profiled Results: Before Optimizations / After Optimizations.

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