1
0

add elapsed time for each day to output

This commit is contained in:
2024-12-05 18:30:51 +01:00
parent 89b36dcb98
commit e8b494859b
2 changed files with 30 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
use std::{collections::HashMap, env::args};
use advent_of_rust_2024::*;
use itertools::Itertools;
use std::time::Instant;
use std::{collections::HashMap, env::args};
fn main() {
let mains: HashMap<u8, fn() -> ()> = HashMap::from_iter([
@@ -18,7 +18,15 @@ fn main() {
.sorted_by_key(|entry| entry.0)
.for_each(|(d, f)| {
println!("Day {d}:");
let start = Instant::now();
f();
let duration = start.elapsed();
println!(
"{color}{italic}Took {duration:?}{reset_formatting}",
color = "\x1b[38;5;247m",
italic = "\x1b[3m",
reset_formatting = "\x1b[0m"
);
});
return;
};