# Optimizations (and fails)
## Day 1
We compare to array window (`a` and `b`) when `a < b` we increment our counter.
```
a: idx-3 + idx-2 + idx-1
b: idx-2 + idx-1 + idx
```
As `idx-2` and `idx-1` are in `a` and `b` too this can be simplified to `idx-3 <
idx`.
This way it fits in `u13`, using `@intCast(u15)` is not necessary.
Gain: 271 μs -> 270 μs :-)
## Day 3
Using `std.heap.FixedBufferAllocator` instead of
`std.heap.GeneralPurposeAllocator` helps.
Gain: 4780 μs -> 2650 μs
## Day 4
I have tried to be smart whith the data structure here: Using an `AutoHashMap`
to store the position of each number in the grid, so I do not have to loop
through the whole grid when searching for a number.
This turns out quite slow: ~2x15 ms.
**Takeaway**: When the grid is small (in this case 5x5) looping through it is quite
fast anyway, it will compensate the HashMap overhead.