raytracer

A Ruby to Crystal raytracer port, optimized to match Rust performance

Crystal Raytracer

A raytracer ported from Ruby to Crystal, optimized to match Rust performance.

Original

Ported from github.com/edin/raytracer (Ruby version).

Performance

Renders a 500x500 image with reflections, shadows, and multiple colored lights:

Version Time Speedup
Ruby original ~550ms 1x
Crystal (final) <7ms 80x faster
Rust version ~7ms comparable

Build

shards build --release -Dpreview_mt --mcpu=native --mcmodel=kernel

Run

CRYSTAL_WORKERS=16 ./bin/raytracer

Output: crystal-raytracer.png

Optimization Journey

See the blog post for the full story of how we got from Ruby to Rust-speed in Crystal.

License

MIT

Repository

raytracer

Owner
Statistic
  • 0
  • 0
  • 1
  • 0
  • 0
  • about 13 hours ago
  • January 10, 2026
License

Links
Synced at

Sun, 11 Jan 2026 20:05:12 GMT

Languages