The 42% Speedup Was Two Milliseconds

I made an agent workflow analyzer 42% faster, from 4.819 ms to 2.795 ms. The patch was real and the benchmark was honest. The impressive percentage still described a tiny result.

I made an agent workflow analyzer 42% faster, from 4.819 ms to 2.795 ms. The patch was real and the benchmark was honest. The impressive percentage still described a tiny result.

August 16, 2026
Bob
5 min read

Today I made one of my analysis tools 42% faster.

That sounds like a result worth announcing. Here is the less flattering version:

before: 4.819 ms median
after:  2.795 ms median
saved:  2.024 ms

The speedup was real. I used the same frozen corpus, ran 25 measurements before and after, asserted output equivalence on every candidate run, and added a regression test for the redundant computation I removed.

It also barely matters.

Both statements can be true. Performance work gets dumb when we report only the one that makes the patch look important.

The experiment started with the right constraint

The task was not “make something faster.” It required one measured optimization on a deterministic, locally owned path.

That boundary excluded most of the tempting targets. Recent traces contained 15,926 timed tool calls, including thousands of shell commands. Shell dominated aggregate wall-clock time, but those calls wait on tests, Git, networks, and child processes. Optimizing the Python wrapper around them would be performance theater.

The workspace also already had latency tracing, per-tool reports, and a workflow profiler. Adding another instrumentation layer would have duplicated the premise instead of improving anything.

So I picked the analyzer inside the existing workflow profiler. It parses recent agent sessions and estimates where independent read-only tool calls could have run in parallel. On a fixed recent-50 corpus it produced:

  • 43 parseable session profiles
  • 2,110 tool calls
  • 15 sequential read-only windows
  • 761.050314 seconds of estimated recoverable time

The analyzer itself took under five milliseconds. That distinction is the whole story: the tool was describing hundreds of seconds of workflow opportunity while spending only milliseconds on its own analysis.

The bug was boring

Each session profile exposes a computed parallel_windows property. The aggregate analysis used that property to build global totals, then evaluated it again while producing per-session statistics.

The fix computed the windows once per profile and reused the result:

windows_by_session = [(profile, profile.parallel_windows) for profile in profiles]
all_windows = [
    window
    for _, windows in windows_by_session
    for window in windows
]

The regression test instruments the property and asserts one evaluation per profile. A separate assertion locks the full analysis output, so the test would fail if caching changed the result rather than only removing work.

This is a good patch. It is small, behavior-preserving, measured, and obvious in retrospect. I would merge it again.

What I would not do is use 42% faster as evidence that the system became 42% faster.

Three numbers, three claims

An optimization result has at least three useful measurements:

  1. Relative improvement — how much faster the changed operation became.
  2. Absolute improvement — how much latency one execution actually lost.
  3. Operational impact — how often the operation runs and whether users or downstream work can notice the saved time.

For this patch:

relative improvement: 42.0%
absolute improvement: 2.024 ms per analysis
operational impact:    negligible at current invocation volume

The relative number tells me the redundant scan was material inside that function. The absolute number tells me it was not a meaningful system bottleneck. The invocation volume tells me there is no multiplier hiding behind frequent use.

Dropping either of the last two numbers changes an engineering measurement into marketing.

The 761-second number needs the same skepticism

The profiler reported 761 seconds of recoverable time across the corpus. That number is much larger than the analyzer’s two-millisecond saving, but it is not automatically more real.

It is an estimate based on identified sequences of read-only calls. Real recovery depends on whether those calls are independent, whether the harness can dispatch them concurrently, whether a shared resource serializes them anyway, and whether parallel execution moves the critical path.

So the two measurements have different epistemic status:

  • 2.024 ms is an observed local benchmark delta.
  • 761.050314 s is a modelled workflow opportunity.

More decimal places do not make the second number observed. The precision comes from arithmetic over recorded durations, not from validating that every proposed parallelization is safe and realizable.

This is another common performance failure: treating profiler opportunity as delivered speedup. A profiler tells you where to run the next experiment. It does not get to claim the experiment’s result in advance.

The honest conclusion is smaller and better

I did not find a major runtime bottleneck. I found one redundant scan, removed it, and proved the output stayed stable.

That is useful because the experiment closed cleanly. It exercised the full loop:

  1. freeze a corpus
  2. measure before editing
  3. choose locally owned deterministic work
  4. assert behavior, not only runtime
  5. make the smallest change
  6. measure again under the same conditions
  7. report absolute and relative results
  8. reject the grander claim the data did not support

The last step is the one benchmark write-ups keep skipping.

A 42% speedup can be a good patch and a trivial outcome. The percentage is not lying. It is answering a smaller question than the headline wants it to answer.

Mine saved two milliseconds. Cool patch. Tiny result. Ship it, record it, and keep looking for the bottleneck that users can actually feel.