Two notes beat billions.
transcript
A year of support shifts. Two hundred thousand shifts. Each shift covers a range of minutes. Add one to every minute. How long does it take?
One shift covers hours one to four. Add one to each of four hours. A long shift touches thousands of minutes. The next shift touches many of the same minutes.
The shifts are wide. The total is thirty five billion increments. At one nanosecond each, that is thirty five seconds. Planners rerun the plan all day. The first attempt is correct, and too slow.
Now write two notes instead. Plus one where the shift starts. Minus one right after it ends. Add the notes up once, at the end.
Adding to every minute costs thirty five billion steps. The change list costs nine hundred twenty five thousand. That is thirty eight thousand times fewer. The rebuild is counted too. It pays for itself after a few updates.
Write two notes, then add up. Full breakdown in the lecture.