This repo contains solutions to Advent of Code 2022 puzzles in Rust.
Last year I tried to stay within stable Rust. This year goals are:
- Be as fast as possible, possibly sacrificing input validation.
- Explore experimental features and const generics.
- Still have little to no dependencies, but be more liberal than I did last year.
Firstly, put your input to src/dayNN/input
.
# Run puzzle for a specific day.
make run/dayNN
# Run criterion benchmarks for a specific day.
make bench/dayNN
I copied the structure of this section from https://github.com/timvisee/advent-of-code-2022 . I also recommend that repo for seing some clean Rust code!
Here is how long each solution runs. All solutions are measured (non
scientifically) in bench.rs
on an
Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
laptop running Linux. Having that in mind, the timings
are close to those obtained (scientifically) with cargo criterion
.
one-by-one (1 CPU core) | parallel | |
---|---|---|
everything | 263.20 ms |
132.64 ms |
I don't include input files because of https://old.reddit.com/r/adventofcode/wiki/faqs/copyright/inputs. This way the benchmarks are not completely reproducible, but I am not going publish a scientific paper anyway. Simply put your input files and run the project to see the solution appear.
# Run everything
cd ../runner
cargo +nightly run --release --bin runner
# or run everything in parallel
cd ../runner
cargo +nightly run --release --bin runner-par
# or benchmark every day
cd ../runner
cargo +nightly run --release --bin bench
This project is released under the GNU GPL-3.0 license. Check out the LICENSE file for more information.