Skip to content

timvisee/advent-of-code-2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code 2022 in Rust

My Advent of Code 2022 solutions in the Rust programming language. This repository holds a separate Rust project for each day and part.

I attempt to develop a standalone, elegant, compact and fast solution for each problem (two each day).

Previous year I did the same, solving everything in under a second:

Timings

Here is how long each solution runs. All solutions are measured (non scientifically) in bench.rs on an AMD Ryzen 9 5900X (24) @ 3.7GHz machine running Linux.

part A part B
day 1 0.027 ms 0.031 ms
day 2 0.006 ms 0.006 ms
day 3 0.015 ms 0.016 ms
day 4 0.040 ms 0.039 ms
day 5 0.020 ms 0.019 ms
day 6 0.001 ms 550 ns
day 7 0.008 ms 0.011 ms
day 8 0.045 ms 0.177 ms
day 9 0.120 ms 0.290 ms
day 10 0.001 ms 0.003 ms
day 11 0.019 ms 5.72 ms
day 12 0.294 ms 51.22 ms
day 13 0.238 ms 0.277 ms
day 14 0.226 ms 6.14 ms
day 15 0.003 ms 16.19 ms
one-by-one (1 CPU core) parallel
everything 81.32 ms 51.86 ms

Run solutions

Each Rust project contains a input.txt file, holding the puzzle input. Simply run the project to see the solution appear.

# Switch to day 1a, and run it
cd day01a
cargo +nightly run --release

# 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

Some solutions require Rust Nightly, that's why +nightly is included.

Other years

License

This project is released under the GNU GPL-3.0 license. Check out the LICENSE file for more information.