Crates.io | rtrace |
lib.rs | rtrace |
version | 1.0.0 |
source | src |
created_at | 2015-02-11 07:52:33.023073 |
updated_at | 2017-01-02 14:53:30.381914 |
description | A pet raytracer to test overall pseudo-performance and multi-threading |
homepage | |
repository | https://github.com/Byron/rust-tracer |
max_upload_size | |
id | 1380 |
size | 372,928 |
Following cinematic success stories such as The SHA1 Performance Quest, there is yet another quest for performance, seeking out benchmark results that no man has seen before !
It's stardate 20.15.01.31, in a universe ruled by nimble Gophers and ancient Ceepeporg, a universe where the production of RaySpheres™ is the only goal, the faster, the better. Meet the Rustaceans, a young species, and follow them on their curious quest for independence and for producing the most RaySperes in the universe.
Generating images is as easy as running make in the respective source folder. We assume you have rust, go and gcc installed and in your PATH.
# rust
make image
# go
make -C src/go image
# c++
make -C src/cpp image
# Use more cores with go implementation to witness speedup
GOMAXPROCS=4 make src/go image
# Same with rust
RTRACEMAXPROCS=4 make image
Even though the rustacean RaySpheres are the prettiest thanks to an improved shading algorithm, on a single core we are not fastest. For some reason, C++ is 7 percent faster even though it is inefficient when creating the scene of more than 20.000 spheres and even though it uses virtual method calls.
Only when rust enters multi-threaded rendering mode, it is the fastest in town, as C++ doesn't implement multi-threading in this case.
Not to forget, go, which is far behind being about three times slower, no matter what.
Things to do, in season two ...
Arc
. The latter is a reference counted item on the heap.Arc<Mutex<R>>
to allow synchronized access.The go
based raytracer was originally written by Jack Palevich. For more information, see http://grammerjack.blogspot.com/2009/11/multi-threaded-go-raytracer.html.