Simulating the World with Ruby
summary
Claims Ruby can run large stochastic simulators if engineered carefully: uses Vose/Alias constant-time sampling for weighted random draws, the distribution gem for PDFs, R and d3 for visualization, and PostgreSQL is too slow for billions of events so in-memory or OLAP stores are recommended. JRuby yields big speed and multi-core gains but exposes GC and memory-retention issues (observed heaps of ~7–11 GB); fix by reset listeners to free arrays and offload hot paths to Java/C. Example run: 1,000 people over 100 years completes in ~129s.
AI-written summary · about
chapters (14)
- 0:00Start
- 1:21Expressive
- 1:41Quick feedback loop
- 2:22Building blocks of simulations
- 2:49Deterministic
- 5:07Stochastic
- 10:10Use ALL the memory
- 17:34gem install distribution
- 20:24brew install spark
- 25:16Memory Management
- 29:34Building a simulator in Ruby
- 34:02gem install algorithms
- 38:28Lessons Learned
- 39:36Ruby lacks in stats/science libs








