GeistHaus
log in · sign up

Solving Advent of Code 2020 in under a second – Danny van Kooten

dannyvankooten.com

Solving all Advent of Code 2020 challenges in C with a total runtime under one second.

1 page links to this URL
Solving the Advent of Code 2021 calendar using C in under half-a-second

Since being introduced to the world of Advent of Code just prior to the 2020 calendar starting, I subsequently spent the majority of 2021 completing (and documenting) the 2015, 2016 and 2017 calendars. For the 2021 calendar, I decided that it would be interesting (and challenging) to complete the calendar in C, with an initial solution written in Python to meet the daily aspect of the challenge. Additionally, with C being such a performant language, I also wanted to set the goal of ensuring that the entire C calendar was solvable on a single CPU core in under half a second (inspired by this blog post). In this post, I wish to discuss how I went about achieving this goal (spoiler: 410315 μs (0.410 s) on average) and the hurdles I faced along the way.

0 inbound links article en posts PythonCAdvent-of-Code