day5: add timing
This commit is contained in:
		@@ -1,9 +1,9 @@
 | 
			
		||||
use std::fs::File;
 | 
			
		||||
use std::io::{BufRead, BufReader, Lines};
 | 
			
		||||
use std::ops::Range;
 | 
			
		||||
use std::time::Instant;
 | 
			
		||||
 | 
			
		||||
use itertools::Itertools;
 | 
			
		||||
use rayon::prelude::*;
 | 
			
		||||
 | 
			
		||||
// --- Day 5: If You Give A Seed A Fertilizer ---
 | 
			
		||||
 | 
			
		||||
@@ -138,8 +138,15 @@ fn get_input() -> InputIter {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn main() {
 | 
			
		||||
    println!("Problem 1 solution: {}", problem1(get_input()));
 | 
			
		||||
    println!("Problem 2 solution: {}", problem2(get_input()));
 | 
			
		||||
    let start = Instant::now();
 | 
			
		||||
    let ans1 = problem1(get_input());
 | 
			
		||||
    let duration = start.elapsed();
 | 
			
		||||
    println!("Problem 1 solution: {} [{}s]", ans1, duration.as_secs_f64());
 | 
			
		||||
 | 
			
		||||
    let start = Instant::now();
 | 
			
		||||
    let ans2 = problem2(get_input());
 | 
			
		||||
    let duration = start.elapsed();
 | 
			
		||||
    println!("Problem 2 solution: {} [{}s]", ans2, duration.as_secs_f64());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PARSING
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user