add runtime measurement

This commit is contained in:
Fabian Schmidt 2024-12-10 11:45:53 +01:00
parent 64cb7fb370
commit dd6e9dbe90
54 changed files with 417 additions and 47 deletions

4
Cargo.lock generated
View File

@ -89,6 +89,7 @@ name = "y2016"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"md5", "md5",
"utils",
] ]
[[package]] [[package]]
@ -114,6 +115,9 @@ version = "0.1.0"
[[package]] [[package]]
name = "y2022" name = "y2022"
version = "0.1.0" version = "0.1.0"
dependencies = [
"utils",
]
[[package]] [[package]]
name = "y2023" name = "y2023"

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y{{YEAR}}::days::d{{DAY}}; use y{{YEAR}}::days::d{{DAY}};
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,20 +1,27 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d1; use y2015::days::d1;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {
let root = env!("CARGO_MANIFEST_DIR"); let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap(); let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap();
println!("{}", d1::process_part1(&content)); println!("Answer: {}", d1::process_part1(&content));
} }
fn part2() { fn part2() {
let root = env!("CARGO_MANIFEST_DIR"); let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap(); let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap();
println!("{}", d1::process_part2(&content)); println!("Answer: {}", d1::process_part2(&content));
} }

View File

@ -1,8 +1,17 @@
use std::time::Instant;
use utils::time::get_elapsed_string;
use y2015::days::d10; use y2015::days::d10;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,8 +1,17 @@
use std::time::Instant;
use utils::time::get_elapsed_string;
use y2015::days::d11; use y2015::days::d11;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d12; use y2015::days::d12;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d13; use y2015::days::d13;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d14; use y2015::days::d14;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d15; use y2015::days::d15;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d16; use y2015::days::d16;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d17; use y2015::days::d17;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d18; use y2015::days::d18;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d19; use y2015::days::d19;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d2; use y2015::days::d2;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,8 +1,17 @@
use std::time::Instant;
use utils::time::get_elapsed_string;
use y2015::days::d20; use y2015::days::d20;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d21; use y2015::days::d21;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d22; use y2015::days::d22;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d23; use y2015::days::d23;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d24; use y2015::days::d24;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,7 +1,13 @@
use std::time::Instant;
use utils::time::get_elapsed_string;
use y2015::days::d25; use y2015::days::d25;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d3; use y2015::days::d3;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::time::Instant; use std::time::Instant;
use utils::time::get_elapsed_string;
use y2015::days::d4; use y2015::days::d4;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d5; use y2015::days::d5;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d6; use y2015::days::d6;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d7; use y2015::days::d7;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d8; use y2015::days::d8;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2015::days::d9; use y2015::days::d9;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -5,3 +5,4 @@ edition = "2021"
[dependencies] [dependencies]
md5 = { workspace = true } md5 = { workspace = true }
utils = { workspace = true }

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2016::days::d1; use y2016::days::d1;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2016::days::d2; use y2016::days::d2;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2016::days::d3; use y2016::days::d3;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2016::days::d4; use y2016::days::d4;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,8 +1,17 @@
use std::time::Instant;
use utils::time::get_elapsed_string;
use y2016::days::d5; use y2016::days::d5;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2016::days::d6; use y2016::days::d6;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
utils = { workspace = true }

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d1; use y2022::days::d1;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d2::{process_part1, process_part2}; use y2022::days::d2::{process_part1, process_part2};
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d3; use y2022::days::d3;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d4; use y2022::days::d4;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d5; use y2022::days::d5;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d6; use y2022::days::d6;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d7; use y2022::days::d7;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d8; use y2022::days::d8;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2022::days::d9; use y2022::days::d9;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d1; use y2024::days::d1;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d10; use y2024::days::d10;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d2; use y2024::days::d2;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d3; use y2024::days::d3;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d4; use y2024::days::d4;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d5; use y2024::days::d5;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d6; use y2024::days::d6;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d7; use y2024::days::d7;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d8; use y2024::days::d8;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {

View File

@ -1,10 +1,17 @@
use std::fs; use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d9; use y2024::days::d9;
fn main() { fn main() {
let now = Instant::now();
println!("Part 1:");
part1(); part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2(); part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
} }
fn part1() { fn part1() {