All my solutions to the Advent of Code challenges, written in Go/Odin. Possibly the only thing I will ever get into the Christmas spirit for 🎄
I've separated each year into its own Go module. Each day is separated into two files, one for each part of the challenge. To run a solution, simply cd
into the directory and run go run . -solution 01p1
(where 01p1
is the day and part you want to run).
The -benchmark
flag can be used to time the execution of the solution. Using the -benchmark
flag on its own will run all solutions for the year 10 times over, getting the average execution time.
The same is true for Odin solutions, except the command to run the solution is odin run . -solution 01p1
.
Note
Benchmarks are run via this GitHub Action and are not indicative of the performance of the code on your machine.
The action uses the ubuntu-latest
image and runs each solution 10 times to get an average. This is by no means a perfect benchmark, so take the results below with a grain of salt.
TODO:
- In the process of improving the performance of Day 5 part 2, I've gone and broken it to the point where it no longer gives the correct answer. So while it is an improvement of the original 1.5 hours, it still needs some work.
- Day 16 part 2 uses a brute force approach to find the answer. I'm certain with heavy caching and dynamic programming, it could be improved significantly.
Day | Part 1 | Part 2 | Stars |
---|---|---|---|
Day 1: Sonar Sweep | 443µs | 807µs | ⭐⭐ |
Day 2: Dive! | 679µs | 834µs | ⭐⭐ |
Day 3: Binary Diagnostic | 346µs | 577µs | ⭐⭐ |
Day 4: Giant Squid | 779µs | 1.221ms | ⭐⭐ |
Day 5: Hydrothermal Venture | 48.474ms | 88.501ms | ⭐⭐ |
Day 6: Lanternfish | 96µs | 134µs | ⭐⭐ |
Day 7: The Treachery of Whales | 1.196ms | 1.565ms | ⭐⭐ |