Skip to main content

Tag: Julia

Advent of Code as a Lab for Fast Computing

This year’s Advent of Code is well past the half-way mark, and I’ve been reflecting on some of the harder or more interesting problems over the last few years, and the lessons learned about making code faster, or large problems tractable.

In case you haven’t encountered it, AoC is an annual coding competition, with a new problem every day, from December 1 through 25. Each day, there are two parts, and the second (usually harder) part unlocks after you solve the first part. You can use any programming language, and only need to submit the right answer (usually a number) to solve each part.

Why Speed Matters

The vast bulk of data science work is done using Python and R, and that’s fine. Those languages are well suited to analytics, and make available a rich infrastucture of libraries and documentation.

Looking at just Python (R is similar), there is however a problem. Python is slow, due to its interpreted execution model and dynamic typing. As a Python program runs, it is constantly checking for the types of different variables and data, and for the feasibility of certain operations such as converting data types and expanding lists. While this makes for fast development and prototyping, it can be very slow for some types of analysis.