|
1 | 1 | /// Encapsulates code that interacts with solution functions. |
2 | 2 | use crate::template::{aoc_cli, Day, ANSI_ITALIC, ANSI_RESET}; |
3 | 3 | use std::fmt::Display; |
| 4 | +use std::hint::black_box; |
4 | 5 | use std::io::{stdout, Write}; |
5 | 6 | use std::process::Output; |
6 | 7 | use std::time::{Duration, Instant}; |
@@ -64,7 +65,7 @@ fn bench<I: Clone, T>(func: impl Fn(I) -> T, input: I, base_time: &Duration) -> |
64 | 65 | // need a clone here to make the borrow checker happy. |
65 | 66 | let cloned = input.clone(); |
66 | 67 | let timer = Instant::now(); |
67 | | - func(cloned); |
| 68 | + black_box(func(black_box(cloned))); |
68 | 69 | timers.push(timer.elapsed()); |
69 | 70 | } |
70 | 71 |
|
|
0 commit comments