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 | 436µs | 815µs | ⭐⭐ |
Day 2: Dive! | 622µs | 597µs | ⭐⭐ |
Day 3: Binary Diagnostic | 283µs | 531µs | ⭐⭐ |
Day 4: Giant Squid | 634µs | 1.125ms | ⭐⭐ |
Day 5: Hydrothermal Venture | 47.44ms | 83.512ms | ⭐⭐ |
Day 6: Lanternfish | 102µs | 147µs | ⭐⭐ |
Day 7: The Treachery of Whales | 1.244ms | 1.589ms | ⭐⭐ |
Day 8: Seven Segment Search | 422µs | 5.056ms | ⭐⭐ |
Day 9: Smoke Basin | 681µs | 7.667ms | ⭐⭐ |
Day 10: Syntax Scoring | 958µs | 1.247ms | ⭐⭐ |