kidoman / rays

Ray tracing based language benchmarks
https://kidoman.com/programming/go-getter.html
95 stars 23 forks source link

rays

Tracker: trello

Ray tracing based language benchmark inspired from:

Reference Image

Reference image rendered using the C++ version: 1 Megapixel (also 2, 3 and 4)

Why?

I have written two blog posts describing the intent behind this:

Reddit discussion thread

Why ray tracing?

Why optimize the base algorithm?

Also, shouldn't we leave it to the compilers to do their best

Optimizing in a particular language also gives you a feel of "how far" you can push the boundaries of performance when the need arises. Micro optimizations are the root of all evil, no doubt; but not when the subject matter is benchmarking itself (plus, it doesn't hurt that it makes the process fun)

Think of this as a great opportunity to learn the various nuances of these languages, which are otherwise extremely hard to learn/master.

Different Implementations

Currently, the following versions are currently available, and tracked in their own folders:

Please feel free to implement the benchmark (refer to the original C++ version here) in the language of your choice. All optimizations are welcome but try not to stray away too far from the spirit of the original algorithm. The existing implementations can always act as a litmus test.

Also, optimizations to the existing implementation are obviously welcome. I will regularly update the results based on activity/updates to the code.

How to use

RAYS_HOME

Set RAYS_HOME environment variable to the top level rays folder before running any of the benchmarks

Benchmark Run

The benchmark is to render a 768x768 image with the text:

R A
Y S

A program is valid if it outputs a valid PPM image to STDOUT.

Prerequisite

Implemented benchmarks

We currently have implementations from:

Please refer to individual README files in the specific folders to find out instructions on how to run the specific benchmark.

Current Performance

The current performance stacks up like so:

512x512 image 2048x2048 image 4096x4096 image

Contributors

The following have contributed to the project one way or the other:

Thanks to everyone for all the help given :)