"Parallel and Thread-Safe Ruby at High-Speed with TruffleRuby"
summary
TruffleRuby on GraalVM and SubstrateVM makes Array and Hash thread-safe without a global lock, using write barrier marking objects shared and dual storage strategies (shared fixed, shared dynamic) plus a layout lock with read/write/layout-change modes. Benchmarks show 200 FPS on a NES emulator (vs ~30–60), up to 7× faster than MRI, 30× on microbenchmarks, and 30 billion array accesses/sec on 144 cores, with single-thread overhead negligible and parallel scaling comparable to Fortran/Java.
AI-written summary · about
chapters (29)
- 0:00Intro
- 1:42Two Modes to Run Truffle Ruby
- 3:06Ruby 33 Project
- 3:37OptCarrot: Demonstration
- 7:34OptCarrot Warmup
- 8:17Classic Benchmarks
- 8:45MJIT Micro-Benchmarks
- 9:57Rails benchmarks? Discourse?
- 11:18How Truffle Ruby achieves great performance
- 11:47From Ruby code to Abstract Syntax Tree
- 13:37Partial Evaluation of foo
- 17:31Loop unrolling
- 18:05Truffle Ruby: Partial Evaluation + Graal Compilation
- 18:38MJIT: The Method JIT for CRuby
- 20:40Ruby Performance Summary
- 21:48The Problem
- 23:57Guilds
- 25:28Appending concurrently
- 26:24A Workaround: using a Mutex
- 26:37Problems of the Workarounds
- 27:51Similar Problem with Objects
- 28:09Lost Object Field Updates
- 29:53Write Barrier Tracking the set of shared objects
- 30:19Single-Threaded Performance for Objects
- 31:11Array Storage Strategies
- 32:35Concurrent Array Strategies
- 33:19Scalability of Array Reads and Writes
- 34:56NASA Parallel Benchmarks
- 35:32Conclusion
related talks
43mParallel and Thread-Safe Ruby at High-Speed with TruffleRuby
23mParallelization of Dynamic Languages - Synchronizing Built-in Collections
25mMaking Hash Parallel, Thread-Safe and Fast!
23mParallel Processing With Ruby
28mConcurrency for Rubyists
42mLook out! Gotchas of Using Threads in Ruby
42mRuby 124c41+
36mRuby Supercomputing: Using The GPU For Massive Performance Speedup
