card-trace icon indicating copy to clipboard operation
card-trace copied to clipboard

Raytraced Rust

A Rust version of the C++ "business card" ray tracer.

Run it

  • rustc --opt-level=3 bin.rs
  • ./bin > rust.ppm
  • convert rust.{ppm,png}
  • Open rust.png with your favourite viewer

Compare it

$ g++ -O3 -lm original.cpp -o cxx
$ time ./cxx > rust.ppm

real    0m17.923s
user    0m17.900s
sys     0m0.012s

$ clang++ -O3 -lm original.cpp -o cxx
$ time ./cxx > rust.ppm

real    0m13.755s
user    0m13.744s
sys     0m0.000s

$ rustc --opt-level=3 bin.rs -o rust
$ time ./rust > rust.ppm

real    0m17.883s
user    0m17.368s
sys     0m0.500s

These all render Rust.