Skip to content

aod/advent-of-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust

This project contains solutions for Advent of Code puzzles.

Quick start

  1. Install the Rust programming language here.
  2. Clone the repository: git clone https://github.com/aod/advent-of-rust.git
  3. Run a solution: cargo run --release -p aoc-<year> --bin <day>

Example

$ cargo run --release -p aoc-2020 --bin 20
    Finished release [optimized] target(s) in 0.01s
     Running `target/release/20`
Part1(17.098503ms):
19955159604613
Part2(9.77521ms):
1639

Tests

Every example and user input is tested and automatically run in CI using GitHub Actions. To run all tests locally execute the following command:

$ cargo test --release

The first non-flag argument in cargo test is used to filter on the function name. Use example or answer to test solutions with the example or user input respectively.

One can further filter down to the year and or day by adding the previously mentioned -p and or --bin flags, as is used in the cargo run example above.

User benchmarks

TODO: Use a benchmarking library instead of manual user benchmarks.

Ran on Intel CPU i5-8250U (8) @ 3.400GHz.

Day Part 1 Part 2 Sum
25 38.407 ms N.A. 38.407 ms
24 596.084 µs 474.467 ms 475.036 ms
23 5.885 µs 1.584 s 1.583 s
22 15.182 µs 848.102 ms 848.117 ms
21 1.302 ms 947.059 µs 2.249 ms
20 16.124 ms 5.726 ms 21.850 ms
19 N.A. N.A. N.A.
18 877.271 µs 1.752 ms 2.629 ms
17 29.106 ms 1.490 s 1.519 s
Total 86.433 ms 4.405 s 4.490 s

.unwrap() counter: 53

About

Advent of Code solutions written in the Rust programming language

Topics

Resources

License

Stars

Watchers

Forks

Languages