feat: add shorthands for running solutions

This commit is contained in:
Felix Spöttel 2022-10-18 11:26:56 +02:00
parent 6613b6bfce
commit bd97e34f66
3 changed files with 9 additions and 7 deletions

View file

@ -1,4 +1,6 @@
[alias] [alias]
rr = "run --release"
scaffold = "run --bin scaffold -- " scaffold = "run --bin scaffold -- "
download = "run --bin download -- " download = "run --bin download -- "
day = "run --bin"
all = "run"

View file

@ -72,8 +72,8 @@ Puzzle inputs are not checked into git. [Reasoning](https://old.reddit.com/r/adv
### Run solutions for a day ### Run solutions for a day
```sh ```sh
# example: `cargo run --bin 01` # example: `cargo day 01`
cargo run --bin <day> cargo day <day>
# output: # output:
# Running `target/debug/01` # Running `target/debug/01`
@ -86,14 +86,14 @@ cargo run --bin <day>
# 9 (elapsed: 33.18µs) # 9 (elapsed: 33.18µs)
``` ```
To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr --bin <day>`. `day` is a shorthand for `cargo run --bin `. To run an optimized version for benchmarking, append the `--release` flag.
Displayed _timings_ show the raw execution time of your solution without overhead (e.g. file reads). Displayed _timings_ show the raw execution time of your solution without overhead (e.g. file reads).
### Run solutions for all days ### Run solutions for all days
```sh ```sh
cargo run cargo all
# output: # output:
# Running `target/release/aoc` # Running `target/release/aoc`
@ -111,7 +111,7 @@ cargo run
# Total: 0.20ms # Total: 0.20ms
``` ```
To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr`. `all` is an alias for `cargo run`. To run an optimized version for benchmarking, use the `--release` flag.
_Total timing_ is computed from individual solution _timings_ and excludes as much overhead as possible. _Total timing_ is computed from individual solution _timings_ and excludes as much overhead as possible.

View file

@ -101,5 +101,5 @@ fn main() {
} }
println!("---"); println!("---");
println!("🎄 Type `cargo run --bin {}` to run your solution.", &day_padded); println!("🎄 Type `cargo day {}` to run your solution.", &day_padded);
} }