Started with aoc 2015, unable to make d4 part2 faster. Multi-threaded actually slower
This commit is contained in:
20
y2015/src/bin/d1.rs
Normal file
20
y2015/src/bin/d1.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use std::fs;
|
||||
|
||||
use y2015::days::d1;
|
||||
|
||||
fn main() {
|
||||
part1();
|
||||
part2();
|
||||
}
|
||||
|
||||
fn part1() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap();
|
||||
println!("{}", d1::process_part1(&content));
|
||||
}
|
||||
|
||||
fn part2() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap();
|
||||
println!("{}", d1::process_part2(&content));
|
||||
}
|
||||
20
y2015/src/bin/d2.rs
Normal file
20
y2015/src/bin/d2.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use std::fs;
|
||||
|
||||
use y2015::days::d2;
|
||||
|
||||
fn main() {
|
||||
part1();
|
||||
part2();
|
||||
}
|
||||
|
||||
fn part1() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/2_input.txt")).unwrap();
|
||||
println!("{}", d2::process_part1(&content));
|
||||
}
|
||||
|
||||
fn part2() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/2_input.txt")).unwrap();
|
||||
println!("{}", d2::process_part2(&content));
|
||||
}
|
||||
20
y2015/src/bin/d3.rs
Normal file
20
y2015/src/bin/d3.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use std::fs;
|
||||
|
||||
use y2015::days::d3;
|
||||
|
||||
fn main() {
|
||||
part1();
|
||||
part2();
|
||||
}
|
||||
|
||||
fn part1() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/3_input.txt")).unwrap();
|
||||
println!("{}", d3::process_part1(&content));
|
||||
}
|
||||
|
||||
fn part2() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/3_input.txt")).unwrap();
|
||||
println!("{}", d3::process_part2(&content));
|
||||
}
|
||||
20
y2015/src/bin/d4.rs
Normal file
20
y2015/src/bin/d4.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use y2015::days::d4;
|
||||
|
||||
fn main() {
|
||||
part1();
|
||||
part2();
|
||||
}
|
||||
|
||||
fn part1() {
|
||||
let now = Instant::now();
|
||||
println!("{}", d4::process_part1("bgvyzdsv"));
|
||||
println!("{}µs", now.elapsed().as_micros());
|
||||
}
|
||||
|
||||
fn part2() {
|
||||
let now = Instant::now();
|
||||
println!("{}", d4::process_part2("bgvyzdsv"));
|
||||
println!("{}µs", now.elapsed().as_micros());
|
||||
}
|
||||
Reference in New Issue
Block a user