Threads

Grow and Shrink - Dynamically Extending the Ruby VM Stack
Keita Sugiyama and Martin J. Dürst • May 31, 2018 • Sendai, Miyagi, Japan

Currently, MRI (the reference implementation of Ruby) allocates 1MB of stack space for each thread. This is clearly sub-optimal, in particular for highly multi-threaded applications.

We have successfully implemented dynamical stack extension for MRI, starting with a very small stack size and growing each stack only when needed.
We will present two different implementations, one very close to the current stack structure, and one with a different stack structure. We will also explain how we made sure that our implementation is stable. On Linux, we achieve a memory reduction per thread of up to 30%, at the cost of an average speed increase (measured across all Ruby benchmarks) of 6%.

RubyKaigi 2018 https://rubykaigi.org/2018/presentations/sugiyama-k

RubyKaigi 2018

Explore all talks recorded at RubyKaigi 2018
+62