strategyLinkmartinfowler.com ↗
The Economic Benefit of Refactoring
A 17,155-line file cost an agent 159,564 input tokens per change. Fifteen refactoring steps cut that by 83% — repair work priced per future change, not by feel.
Why we picked it · the editor's summary
Edwards-Alexander ran the same feature prompt against fresh agents after each of fifteen refactoring steps on a Rust data-access layer and measured the input tokens every run consumed. As the largest file went from 17,155 lines to 3,695 across nineteen files, the tokens a change needed fell from 159,564 to 27,360, while output tokens barely moved. He prices the saving per task at Sonnet 5 rates and notes it recurs on every future change to that code. He calls it one experiment on a greenfield codebase and asks for the same measurement on harder changes and on refactoring done continuously. If you are pricing a refactor, tokens per change is a number you can put on the ledger.
Read on martinfowler.com ↗15m read
Comments
Loading comments…