From C to Ruby: Porting Doom
optcarrot has become a de-facto benchmark for Ruby performance experiments, but it represents a relatively simple rendering workload. To explore a different performance profile, I ported the core of the 1993 game Doom to Ruby, including its BSP-based renderer translated directly from Chocolate Doom.
Despite its reputation, Doom is not a raycaster but a constrained 3D engine operating on 2D maps, with dynamic lighting, sprites, stairs, and variable floor heights. This makes it a surprisingly rich real-time, CPU-bound workload for Ruby.
In this talk, I will describe strategies for porting a large C codebase to Ruby, validating correctness via frame-by-frame comparison with the original engine, and measuring performance. I will also show how modern Ruby features such as YJIT affect a real-time renderer, where the engine reaches playable frame rates at 320×240 but quickly exposes bottlenecks at higher resolutions.
Includes a demo (gem install doom && doom).
-
Chris HasińskiA developer with fifteen years of experience, mostly interested in Ruby applications performance and machine learning.