I measured token cost per changed line on 36 merged PRs: the knotted diffs cost 29% more to review
My agent review bill for one Node service climbed about 18% last month and the pull request count barely moved. Twenty-two merged in October, twenty-three in November, same five step pipeline, same model, same prompt. The number that actually moved was input tokens per review, and I could not have told you which pull requests were doing it. I spent two weeks assuming something had changed on the…
A recent study found that pull requests with complex methods and conditions cost 29% more to review, compared to healthy code. Researchers Marcus Borg and others analyzed 465 pull requests from 246 open-source repositories across three LLMs and found a 22-35% increase in cost due to these factors. To test this, the author measured token cost per changed line in a single TypeScript-based Node service.
After analyzing 36 merged pull requests over 11 weeks, they discovered that the top third of pull requests with high conditional density had a median of 10.4 branching tokens per 100 changed lines and a nesting depth of 4. The bottom third had a median of 2.7 branching tokens and a depth of 2, with a 29% higher input token cost per changed line.
This aligns with the initial research findings, proving that code health impacts inference cost, though the scale may be smaller in this case. The author also noticed that during the review process, step two (reading touched files) consumed more tokens for the knotted third, leading to longer reviews and lower conversion rates to code changes.
They propose ranking diffs before reviews, limiting token consumption in step two, and monitoring per-step token usage to identify where costs are increasing.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to