u8s are faster than u32s

This commit is contained in:
2025-12-03 22:13:51 -05:00
parent 7a3c36000c
commit 3a305e1bce
2 changed files with 3 additions and 3 deletions

View File

@@ -34,4 +34,4 @@ Timings are given as: [lower-bound **best-estimate** upper-bound]
|-----|--------|--------|
| 01 | [101.34 µs **101.95 µs** 102.61 µs] | [105.90 µs **106.40 µs** 106.95 µs] |
| 02 | [2.0990 ms **2.1113 ms** 2.1236 ms] | [2.0954 ms **2.1055 ms** 2.1157 ms] |
| 03 | [623.89 µs **631.99 µs** 641.14 µs] | [786.95 µs **793.43 µs** 800.13 µs] |
| 03 | [45.004 µs **45.240 µs** 45.470 µs] | [180.62 µs **181.41 µs** 182.20 µs] |

View File

@@ -6,7 +6,7 @@ pub const INPUT: &str = include_str!("input/input.txt");
#[derive(Debug, Clone, Copy)]
struct Battery {
column: usize,
joltage: u32,
joltage: u8,
}
impl Default for Battery {
@@ -33,7 +33,7 @@ fn largest_output_joltage<const N: usize>(input: &str) -> Result<u64> {
line,
" ".repeat(column)
)
})?;
})? as u8;
let min = N.saturating_sub(line_len - column);
for i in min..N {
if joltage > batteries[i].joltage {