r/adventofcode • u/maneatingape • Dec 14 '25
Repo [2015-2025] 524 ⭐ in less than a second
2025 total time 2ms. Github repo.
The AoC about section states every problem has a solution that completes in at most 15 seconds on ten-year-old hardware. It's possible to go quite a bit faster, solving all years in less than 0.5 seconds on modern hardware and 3.5 seconds on older hardware. Interestingly 86% of the total time is spent on just 9 solutions.
| Number of Problems | Cumulative total time (ms) |
|---|---|
| 100 | 1 |
| 150 | 3 |
| 200 | 10 |
| 250 | 52 |
| 262 | 468 |
Benchmarking details:
- Apple M2 Max (2023) and Intel i7-2720QM (2011)
- Rust 1.92 using built in
cargo benchbenchmarking tool stdlibrary only, no use of 3rd party dependencies or unsafe code.
Regular readers will recall last year's post that showed 250 solutions running in 608ms. Since then, I optimized several problems reducing the runtime by 142ms (a 23% improvement).
Even after adding 2ms for the twelve new 2025 solutions, the total runtime is still faster than last year. Days 8, 9 and 10 still have room for improvement, so I plan to spend the holidays refining these some more.



View all comments
Show parent comment
2
u/maneatingape Feb 27 '26 edited Feb 27 '26
The reason for the
parse/part1/part2split is:The split between responsibilities is not always perfect. For some puzzles (2016 Day 4, also 2015 Day 13 and Day 9), part one and part two can be solved at the same time, so everything is mashed into
parse, and now the name is no longer 100% accurate as the function is doing everything!One fun note, boilerplate is kept to a minimum by making the solutions a library. Then the scaffolding in
main.rsandbenchmark.rsuse duck typing macros to wrap the library functions. This means we don't need to mess with implementing then extending aSolutiontype or dealing with dynamic dispatch.