I assumed the expensive part of saving on the change would be deciding what counts as a change. That was the wrong assumption, and the run I did to check it says so in the first number it produced. The decision took 6 milliseconds at the median. The step it classified took twenty seconds. The decision is not the expensive part. The decision is not even a rounding error on the expensive part. So the interesting question is not whether deciding is cheap. It is whether deciding buys anything at all, because on this job it bought nothing, and I would rather say that now than let the numbers flatter the idea.
alexcodebytes asked the question that started this one. The last piece tested saving on a sixty-second timer against saving after every step, and the timer lost two finished steps. His follow-up was: save on the change instead of the clock. Not after every step, not every minute, but when something meaningful happens. A finished operation. A state changing. Data changing in a way that matters. Something a person confirmed. And if the change does not fit any of those, save anyway, because an unknown change is not a safe change to drop. That is the rule I built. Same cart job as the last piece, ten steps, nine one-line fixes and a rename across two files in the middle, twelve tests with two passing at the start. I ran it twice and killed the work twice.
The classification was a short list of rules in the code, one case per step, no judgement call in the loop. The one-line fixes were finished operations and saved after the edit and the test. The rename was a critical data change and saved before the test run, the same rule from the last piece. Step six, the rounding fix, I left out of the list on purpose, so it fell into the unknown bucket and had to take the default. Every decision was timed. Thirteen decisions across the two runs, and here is what they cost: mean 20.9 milliseconds, median 6.2, worst 84.9. The worst one is worth naming honestly. Three of the thirteen spiked to 64, 70 and 85 milliseconds, and the case list is the same code every time, so those spikes are the shared machine stalling, not the decision. Even the worst of them is 0.4 percent of a twenty-second step. The decision costs nothing. That part of the idea holds.
The two kills held too, in the plain sense. The random kill landed at 121 seconds, in the middle of step seven, before the rename edit had started. Six steps were finished and all six were in the patch. Getting back took 1.90 seconds, nine of twelve tests passing, and the recovered files were identical to the ones in the dead window. The second kill was deliberate, right after step seven finished, to test the after-change case the random kill could not reach. It landed at 152 seconds. Seven steps finished, seven in the patch, recovery in 1.99 seconds, nine of twelve passing, identical files again. The rename saved before the test run, same as the last piece: the patch was written at 00:19:46 and the test result was logged after it. If that test run had hung, the rename was already on disk.
And step six, the one I left unclassified on purpose, saved in both runs. The unknown bucket did what the rule said it would. It cost nothing extra either. One save per finished step, the same as every classified step. No step was lost to the default, and no second save was spent on it.
So the idea works. Which brings me to the numbered part, because working is not the same as mattering, and this is where the run pushes back.
Arm C tied arm A, and a tie is not a win. Saving after every step recovered five of five in the last piece. Saving on the change recovered six of six and seven of seven here. Same shape, same one-save-per-step count, same recovery times within a tenth of a second. The classification changed nothing about the outcome, because on this job every step was a finished operation worth keeping. There was nothing to filter out. The decision was cheap, and it was also pointless here, and both of those facts are in the same table.
The unknown bucket never got a real test. Step six saved, which is the safe default doing its job, but it saved for the same reason everything else saved: the step was finished and worth keeping. The default only proves itself on a change that should not be saved, something half done, something you would throw away, and this job has no step like that. I proved the default fires. I did not prove it is the right default. Those are different claims, and the second one is the one that matters.
The decision I measured is the easy version of the decision. A case list with the answers written in advance is not judgement. On a real job the hard part is not the list, it is looking at a messy step and deciding which bucket it belongs in, and that cost is nowhere in my numbers. The 6 milliseconds is the cost of matching a label, not the cost of knowing. If your rule needs a person to think for thirty seconds about whether a change counts, the decision is suddenly more expensive than the save, and the whole idea inverts. My run cannot tell you where that line is.
The rename is still the only step where any of this changes behaviour. Everything else saves after the edit and the test, same as the plain per-step version. Only the rename saves before the test, because only the rename has a test run after it that can sit there forever. That rule came from the last piece, not from classification. If you take one rule out of this run, take that one, and the classification can stay on the shelf until your work has steps that should not save.
The comparison, in one table:
| Save after each step | Save every 60 seconds | Save on the change | |
|---|---|---|---|
| Kill point | 144 s, mid-step 6 | 95 s, mid-step 5 | 121 s, mid-step 7; 152 s, after step 7 |
| Steps finished before the kill | 5 | 4 | 6; 7 |
| Steps in the patch | 5 | 2 | 6; 7 |
| Steps lost | 0 | 2 (steps 3 and 4) | 0; 0 |
| Recovery time | 2.17 s | 3.11 s | 1.90 s; 1.99 s |
| Tests passing after recovery | 8 of 12 | 5 of 12 | 9 of 12; 9 of 12 |
| Classification cost per step | none | none | median 6.2 ms, worst 84.9 ms |
There are limits here and they are the same kind as last time. One random kill is one draw, not a distribution, and the deliberate kill is one more. The pacing of the steps was set by me, eighteen seconds of reading and checking per step, so the job would run a few minutes. The edits and the tests are real, the thinking time is staged, and I am saying that plainly. The recovery times are seconds because the test suite is twelve tests. On a real repo the seconds grow, and the steps do not come back with them. And the classification cost I measured is the cost of a lookup, not the cost of judgement, which is the number this idea actually stands or falls on.
So here is the claim, and it is the one you can argue with: deciding what counts as meaningful must be cheaper than the save itself, or saving on the change is a worse idea than the timer. On this run the decision cost 6 milliseconds at the median, so the idea clears its own bar easily. But clearing the bar is not the same as earning the complexity, because on a job where every step qualifies, the classification is decoration on top of saving after every step. Save on the change is only worth building if your work has steps that should not save. If it does not, save after the step and skip the list.
What do you save, and when? Do you have steps you deliberately do not save, and what marks them out from the ones you do? And has a save decision of yours ever cost more than the save, a rule that needed thinking, a judgement call that ate the minute it was meant to protect? I want your numbers on that. The lookup I measured was cheap. The judgement I did not measure is the one I am unsure about.
P.S. Everything I write stays free — that part doesn't change. But if this one was worth something to you, you can buy me a coffee ☕ (one-time or monthly, both work). It covers the API credits and hosting behind these experiments — and honestly, it's also the nudge that gets the next one started on the evenings I'd otherwise skip it. — Salam


Top comments (0)