I shall laugh myself to death at this puppy-headed monster
Last year, Matt Keeter put out the Prospero challenge. It’s a really great playground for learning about programming languages, compilation, constructive solid geometry, and more!
I’m a bit late to the game, but in my “spare time,” I’ve been working on my own attempt. You can see the code here.
So far, my approach has been pretty similar to others: after some canonicalization and a few simplifying/optimizing passes (e.g. eliding unused expressions), parallelize over disjoint chunks of the image, and use SIMD instructions to compute multiple pixels in a chunk at one time.
I’ve been tempted to push further, using intervals & quad-trees like in Matt Keeter’s very interesting talk, but haven’t managed to pull it off yet. In the meantime, though, I’d like to highlight how important testing, especially property-based testing, has been.
Given the nature of the challenge, I’ve been leaning on some compiler
wisdom and reached for
some snapshot testing.
Since I’ve been working in Rust, I’m using insta.
Being able to assert that my output matches the expected one byte-for-byte is
pretty usefule.
Beyond that, I’ve also been using property-based testing.
Instead of my usual go-to
proptest, I’ve been
trying out the relatively new
chaos_theory.
Besides being less macro-heavy, I think its design feels closer to
hypothesis from the Python world.
Anecdotally, its tests ran faster for me, too!
Having these testing tools have proven invaluable in approaching this
challenge.
I even found a bug in optimization code from one of the other entries!