I ran my ray tracer on my desktop and laptop with various numbers of threads and took one sample per pixel.
The plot below shows the run times for each number of threads averaged over 10 runs, measured from a build compiled with
-O2 -march=native. Measurements were taken using std::chrono::high_resolution_clock
and only include time to render, ie. time to load the scene and write the images to disk is ignored.
Swapping to GIMP or some other image viewer every time to see the render is pretty tedious, so to see the output
immediately as it renders I put together a little live previewer that displays your color buffer as the
scene is rendered. This should be really cool to watch when we start implementing techniques like path tracing and
photon mapping. Since the current scene is too simple to be rendered slowly enough for us to see the
rendering in action I added short pauses to the worker threads to slow them down enough to be drawn nicely.
Below are some animations of the slowed down render running on 4 and 12 threads. In these animations you're
able to see how the work area of the image is split into sub-sections for each thread to work on which is neat.
I'm not much of an editor so forgive me for the video including the window opening.