An open API service indexing awesome lists of open source software.

https://github.com/smudger/aoc2022-rust

🎄 My solutions to the Advent of Code 2022. Written in Rust.
https://github.com/smudger/aoc2022-rust

advent-of-code advent-of-code-2022 advent-of-code-2022-rust aoc aoc-2022 aoc-2022-rust aoc-rust aoc2022 rust rust-lang rustlang

Last synced: 4 months ago
JSON representation

🎄 My solutions to the Advent of Code 2022. Written in Rust.

Awesome Lists containing this project

README

        

:repo: https://github.com/smudger/aoc2022-rust/blob/main
:aoc: https://adventofcode.com/2022/day

== :christmas_tree: Advent of Code 2022 - Rust

My solutions to the https://adventofcode.com/2022[Advent of Code 2022]. Written in https://www.rust-lang.org[Rust].

=== :running_woman: Running the solutions

Each Rust project contains one `input.txt` file and two project binaries `part1.rs` and `part2.rs`. The `input.txt` file contains the puzzle input for that day, and the binaries contain the solution to each part of the puzzle. Simply run the project with the desired binary to see the solution for that part of the problem appear.

The project may also contain a number of example inputs named sequentially starting from `example01.txt`. These inputs are used for the tests found in `lib.rs` and are not used to produce the actual solution.

[source,bash]
----
# Switch to day 1, and run part 1
cd day01
cargo run --release --bin part1

# or run part 2
cargo run --release --bin part2
----

=== :trophy: Benchmarking

The {repo}/runner[`runner`] directory contains a binary {repo}/runner/src/bin/bench.rs[`bench.rs`] to benchmark the execution times for each of the solutions.

[source,bash]
----
# Benchmark the solutions for each day
cd runner
cargo run --release --bin bench
----

The {repo}/runner/src/bin/bench-ci.rs[`bench-ci.rs`] binary is used on the CI pipeline to benchmark the execution times more objectively, though still only provides a rough estimation. You can find the results below.

image::https://github.com/smudger/aoc2022-rust/actions/workflows/benchmark.yml/badge.svg["https://github.com/smudger/aoc2022-rust/actions/workflows/benchmark.yml"]

[format="csv"]
[options="header"cols=",m,m"]
|===========================
,Part 1,Part 2
{aoc}/1[Day 01],{repo}/day01/src/lib.rs[0 ms],{repo}/day01/src/lib.rs[20 ms]

|===========================

=== :heart: Inspiration

The project structure is inspired by the Rust Advent of Code repos by https://github.com/timvisee/advent-of-code-2022[Tim Visée] and https://github.com/ChristopherBiscardi/advent-of-code[Chris Biscardi].

The benchmarking implementation is inspired by https://github.com/timvisee/advent-of-code-2022[Tim Visée].

=== :bookmark: License

This project is released under the GNU GPL-3.0 license. Check out the {repo}/LICENSE[LICENSE] file for more information.