In my previous post [1], I sent a ho-ho-hopeful plea that you would join me in playing Advent of Code this year. So, how's it going? We're more than halfway through, and at this point, the going usually gets a bit tougher. Given the commitment, it's not uncommon to see people drop off, but there will always be time after the holidays. The tricky bit is getting the puzzles to be completed in a reasonable period of time from this day forward. As I previously mentioned, my weapon of choice is Python (using my toolkit [2]), which some may find unusual since I tell them I also play competitively on *execution time* (I don't try for leaderboards). Usually, if I ask, "How do I make this faster?" the first answer is, "Don't use Python." 😂 But I love Python. I love the Zen of Python. Cloudsmith is almost entirely written in Python. It can be fast, but you have to work for it. Inspired by David Singleton's previous blog post about completing Advent of Code 2023 in less than one second [2], I also wanted to continue the trend. With some not-so-mild sweating, I'm doing OK so far (see image). * There have been many grid-related problems this year, and my new joke is that there are actually *three* problems in computer science: naming things, caching things, off-by-one errors, and more grids. So, what's your favorite puzzle so far if you're playing? I immensely enjoyed Day 9 and Day 13. Day 9 because it was nostalgic writing a mini disk defragmenter (ah, the olden days!) Day 13 = Linear Algebra saves the day. * Timings executed over 20 runs (pypy JIT optimizes); cold time = 487ms. 😅Interestingly, this is still significantly faster than CPython 3.13, which executes in 535ms and doesn't do JIT optimization, so it's consistently around that. [1] https://lnkd.in/eidPTQUx [2] https://lnkd.in/eFiXxp8S [3] https://lnkd.in/euEhVcpW #AdventOfCode #Python
... and then, today, we have an *actual* maze to navigate. Visualization? Why not.
Today's involved robots pushing boxes around a warehouse. I decided to add depth-based lighting to the visualization for entertainment purposes (note: any visualizations are optional; if you think this is good, you should see some of the mind-bending visualizations people do on Reddit).
Founder & CTO @ Cloudsmith | Cloud-Native Artifact Management
4moI will do myself a disservice by adding code to remove outliers for timing beyond the interquartile range (IQR) or 5th/95th percentile. For some runs, PyPy gets *much* faster after 10 iterations and begins to skew the timing a little too much. Am I only lying to myself? I'm not sure. 😆 If anyone has a better idea of getting more accurate timing, let me know!