Advent of Code 2020 in Rust
My Advent of Code 2020 solutions in the Rust programming language. This repository holds a separate Rust project for each day and part.
This year I attempt to develop a standalone, short, compact and fast solution for each problem (day part).
I've written an article about my solutions here: https://timvisee.com/blog/solving-aoc-2020-in-under-a-second/
Timings
Here is how long each solution takes to run to completion.
All solutions are measured (non scientifically) with hyperfine
on
a i5-4670k @ 3.8Ghz
machine running Linux.
Timings include binary loading, execution, input and output timings.
one-by-one | parallel | |
---|---|---|
everything | 699ms |
511ms |
Run solutions
Each Rust project contains a input.txt
file, holding the puzzle input. Simply
run the project to see the solution appear.
# One solution requires large stack size, set to allow unlimited size
ulimit -s unlimited
# Switch to day 1a, and run it
cd day01a
cargo run --release
# Or run everything in parallel
cd ../runner
cargo run --release --bin runner-par
# Or benchmark every day
cd ../runner
cargo run --release --bin bench
Some solutions might require Rust Nightly.
Other years
License
This project is released under the GNU GPL-3.0 license. Check out the LICENSE file for more information.