diff --git a/README.md b/README.md index eaa5720..dea86ed 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ --- -Generated with the [advent-of-code-rust](https://github.com/fspoettel/advent-of-code-rust) template. +Generated from [fspoettel/advent-of-code-rust](https://github.com/fspoettel/advent-of-code-rust). ## Create your own - 1. Open the [advent-of-code-rust](https://github.com/fspoettel/advent-of-code-rust) template on Github. + 1. Open ☝️ template on Github. 2. Click `Use this template` and create your repository. 3. Clone the repository to your machine. @@ -41,6 +41,8 @@ Generated with the [advent-of-code-rust](https://github.com/fspoettel/advent-of- # 🎄 Type `cargo run --bin 01` to run your solution. ``` +Individual solutions live in the `./src/bin` directory as separate binaries. + Every [solution](https://git.io/JyXa8) has _unit tests_ referencing the _example_ file. Use these tests to develop and debug your solution. When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests. ### Download inputs for a day @@ -81,6 +83,8 @@ cargo run --bin To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr --bin `. +Displayed _timings_ show the raw execution time of your solution w/o overhead (e.g. file reads). + ### Run solutions for all days ```sh @@ -104,6 +108,8 @@ cargo run To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr`. +_Total timing_ is computed from individual solution _timings_ and excludes overhead. + ### Run all solutions against example input ```sh diff --git a/src/lib.rs b/src/lib.rs index c6e5548..fa11f47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,10 +15,10 @@ macro_rules! solve { fn print_result(func: impl FnOnce(&str) -> T, input: &str) { let timer = Instant::now(); let result = func(input); - let time = timer.elapsed(); + let elapsed = timer.elapsed(); println!( "{} {}(elapsed: {:.2?}){}", - result, ANSI_ITALIC, time, ANSI_RESET + result, ANSI_ITALIC, elapsed, ANSI_RESET ); }