- Notifications
You must be signed in to change notification settings - Fork29
Blazing fast Rust solutions for every Advent of Code puzzle from 2015 to 2025, solving 524 stars in less than 1 second.
License
maneatingape/advent-of-code-rust
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Blazing fast Rust solutions for everyAdvent of Code puzzle from 2015 to 2025, taking472 milliseconds to solve all 524 stars. Each solution is carefully optimized for performancewhile ensuring the code remains concise, readable, and idiomatic.
- Minimal - Depends only on the standard library.
- High Quality - Formatted with
rustfmt, linted byclippyand continuously testedviaGitHub Actions. Nounsafecode. - Well Documented - Every solution is comprehensively commented withrustdoc-generated documentation also available online.
Show details
Input
Place input files ininput/yearYYYY/dayDD.txt including leading zeroes. For example:
input/year2015/day23.txtinput/year2023/day02.txt
Run
- Everything
cargo run - Specific year
cargo run year2023 - Specific day
cargo run year2023::day01 - Release profile (faster)
cargo run --release - Optimized for current CPU architecture (fastest)
RUSTFLAGS="-C target-cpu=native" cargo run --release
Test
- Everything
cargo test - Specific year
cargo test year2023 - Specific day
cargo test year2023::day01 - Show STDOUT for debugging
cargo test -- --nocapture
Benchmark
- Everything
cargo bench - Specific year
cargo bench year2023 - Specific day
cargo bench year2023::day01
Document
- Build docs including private items
cargo doc --document-private-items - Build docs then open HTML landing page
cargo doc --document-private-items --open
Miscellaneous
- Code quality lints
cargo clippy - Consistent code formatting
cargo fmt
Improvements to solutions are always appreciated. Please see thedetailed instructions on how to get started.
Benchmarks are measured using the built-incargo bench tool run on anApple M2 Max.Interestingly 86% of the total time is spent on just 9 solutions.Performance is reasonable even on older hardware, for example a 2011 MacBook Pro with anIntel i7-2720QM processor takes 3.5 seconds to run the same 262 solutions.
| Year | 2025 |
|---|---|
| Benchmark (ms) | 2 |
| Year | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 |
|---|---|---|---|---|---|---|---|---|---|---|
| Benchmark (ms) | 14 | 109 | 57 | 35 | 13 | 220 | 8 | 5 | 5 | 4 |
| Day | Problem | Solution | Benchmark (μs) |
|---|---|---|---|
| 1 | Secret Entrance | Source | 24 |
| 2 | Gift Shop | Source | 1 |
| 3 | Lobby | Source | 21 |
| 4 | Printing Department | Source | 177 |
| 5 | Cafeteria | Source | 20 |
| 6 | Trash Compactor | Source | 20 |
| 7 | Laboratories | Source | 5 |
| 8 | Playground | Source | 527 |
| 9 | Movie Theater | Source | 40 |
| 10 | Factory | Source | 296 |
| 11 | Reactor | Source | 75 |
| 12 | Christmas Tree Farm | Source | 25 |
| Day | Problem | Solution | Benchmark (μs) |
|---|---|---|---|
| 1 | Historian Hysteria | Source | 21 |
| 2 | Red-Nosed Reports | Source | 40 |
| 3 | Mull It Over | Source | 8 |
| 4 | Ceres Search | Source | 77 |
| 5 | Print Queue | Source | 18 |
| 6 | Guard Gallivant | Source | 405 |
| 7 | Bridge Repair | Source | 136 |
| 8 | Resonant Collinearity | Source | 8 |
| 9 | Disk Fragmenter | Source | 106 |
| 10 | Hoof It | Source | 38 |
| 11 | Plutonian Pebbles | Source | 227 |
| 12 | Garden Groups | Source | 289 |
| 13 | Claw Contraption | Source | 14 |
| 14 | Restroom Redoubt | Source | 74 |
| 15 | Warehouse Woes | Source | 303 |
| 16 | Reindeer Maze | Source | 350 |
| 17 | Chronospatial Computer | Source | 2 |
| 18 | RAM Run | Source | 42 |
| 19 | Linen Layout | Source | 110 |
| 20 | Race Condition | Source | 1113 |
| 21 | Keypad Conundrum | Source | 19 |
| 22 | Monkey Market | Source | 688 |
| 23 | LAN Party | Source | 43 |
| 24 | Crossed Wires | Source | 23 |
| 25 | Code Chronicle | Source | 8 |
| Day | Problem | Solution | Benchmark (μs) |
|---|---|---|---|
| 1 | Sonar Sweep | Source | 6 |
| 2 | Dive! | Source | 12 |
| 3 | Binary Diagnostic | Source | 22 |
| 4 | Giant Squid | Source | 8 |
| 5 | Hydrothermal Venture | Source | 158 |
| 6 | Lanternfish | Source | 1 |
| 7 | The Treachery of Whales | Source | 8 |
| 8 | Seven Segment Search | Source | 14 |
| 9 | Smoke Basin | Source | 64 |
| 10 | Syntax Scoring | Source | 14 |
| 11 | Dumbo Octopus | Source | 55 |
| 12 | Passage Pathing | Source | 25 |
| 13 | Transparent Origami | Source | 22 |
| 14 | Extended Polymerization | Source | 11 |
| 15 | Chiton | Source | 2403 |
| 16 | Packet Decoder | Source | 6 |
| 17 | Trick Shot | Source | 7 |
| 18 | Snailfish | Source | 476 |
| 19 | Beacon Scanner | Source | 615 |
| 20 | Trench Map | Source | 511 |
| 21 | Dirac Dice | Source | 278 |
| 22 | Reactor Reboot | Source | 378 |
| 23 | Amphipod | Source | 1714 |
| 24 | Arithmetic Logic Unit | Source | 4 |
| 25 | Sea Cucumber | Source | 551 |
| Day | Problem | Solution | Benchmark (μs) |
|---|---|---|---|
| 1 | Report Repair | Source | 12 |
| 2 | Password Philosophy | Source | 35 |
| 3 | Toboggan Trajectory | Source | 8 |
| 4 | Passport Processing | Source | 38 |
| 5 | Binary Boarding | Source | 11 |
| 6 | Custom Customs | Source | 35 |
| 7 | Handy Haversacks | Source | 58 |
| 8 | Handheld Halting | Source | 8 |
| 9 | Encoding Error | Source | 9 |
| 10 | Adapter Array | Source | 1 |
| 11 | Seating System | Source | 831 |
| 12 | Rain Risk | Source | 12 |
| 13 | Shuttle Search | Source | 1 |
| 14 | Docking Data | Source | 83 |
| 15 | Rambunctious Recitation | Source | 103000 |
| 16 | Ticket Translation | Source | 120 |
| 17 | Conway Cubes | Source | 102 |
| 18 | Operation Order | Source | 24 |
| 19 | Monster Messages | Source | 362 |
| 20 | Jurassic Jigsaw | Source | 42 |
| 21 | Allergen Assessment | Source | 45 |
| 22 | Crab Combat | Source | 5333 |
| 23 | Crab Cups | Source | 109000 |
| 24 | Lobby Layout | Source | 330 |
| 25 | Combo Breaker | Source | 20 |
About
Blazing fast Rust solutions for every Advent of Code puzzle from 2015 to 2025, solving 524 stars in less than 1 second.
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.