Here are my solutions for the Advent of Code 2021 Challenge. Solutions are to be provided in Go and Rust1.
I will attempt to write as elegant and performant a solution as possible2 in both languages. Is it possible to solve every puzzle in under a second? All language features are on the table.
1. I have never used Rust at the time of writing, but feel this is a perfect opportunity to learn
2. I don't profess to being an expert in any of these languages
To build and run Go solutions:
cd go && make
./bin/aoc-2021 --benchmark
To build and run Rust solutions:
cd rust/aoc
cargo +nightly run --bin benchmark --release
All puzzles were benchmarked on the following laptop:
macOS Big Sur (11.5.2)
MacBook Pro (2019)
2.3 GHz 8-Core Intel Core i9
16 GB 2667 MHz DDR4
Go | Part A | Part B | Rust | Part A | Part B |
---|---|---|---|---|---|
Day 1 | 0.046ms |
0.036ms |
Day 1 | 0.034ms |
0.035ms |
Day 2 | 0.089ms |
0.091ms |
Day 2 | 0.041ms |
0.041ms |
Day 3 | 0.026ms |
0.058ms |
Day 3 | 0.028ms |
0.032ms |
Day 4 | 0.248ms |
0.443ms |
Day 4 | - | - |
Day 5 | 0.809ms |
1.232ms |
Day 5 | 0.218ms |
0.538ms |
Day 6 | 0.004ms |
0.006ms |
Day 6 | 0.003ms |
0.003ms |
Day 7 | 0.076ms |
0.019ms |
Day 7 | 0.017ms |
0.016ms |
Day 8 | 0.071ms |
0.147ms |
Day 8 | 0.023ms |
0.059ms |
Day 9 | 0.087ms |
0.110ms |
Day 9 | 0.056ms |
0.084ms |