Skip to content

perf(coding-agent): fast-path single-line intra-line diffs#41

Merged
code-yeongyu merged 1 commit into
mainfrom
perf/diff-intraline-fastpath
Jun 15, 2026
Merged

perf(coding-agent): fast-path single-line intra-line diffs#41
code-yeongyu merged 1 commit into
mainfrom
perf/diff-intraline-fastpath

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Ports WI-5 from plans/port-gajae-3day-remaining-optimizations.md.

  • adds conservative fast paths for single-line intra-line diff rendering
  • falls back to Diff.diffWords unless the replacement span is provably byte-equivalent
  • adds parity/no-diffWords regression tests and a word-diff benchmark suite

Evidence

RED:

  • cd packages/coding-agent && npx tsx ../../node_modules/vitest/dist/cli.js --run test/diff-intraline-fastpath.test.ts test/diff-intraline-no-diffwords.test.ts
  • Failed before implementation: 2 files, 4 failed tests.

GREEN:

  • Same targeted vitest command passed: 2 files, 4 tests.
  • Reran by worker, reviewer, and root verification.

Manual/data-surface QA:

  • node scripts/run-pr530-benchmarks.mjs --suite word-diff --iterations 30 --json /tmp/wi5-word-diff-final-head.json --baseline /tmp/wi5-word-diff-base.json --expect-median-improvement 10 --allow-regression-pct 0
  • Median: 22.34375ms -> 8.114834ms (63.68% improvement)
  • Comparison failures: []

Adversarial review:

  • First reviewer found a parity bug for punctuation-adjacent replacements, e.g. " a-" -> " --".
  • Added the regression and tightened the fast path to ASCII word-character replacement spans.
  • Second reviewer returned confirmed / UNCONDITIONAL APPROVAL.

Full check:

  • npm run check passed locally and in the pre-commit hook.
  • It still prints existing Biome info diagnostics outside this scoped change.

Cleanup

  • No staged files remain after commit.
  • /tmp/wi5-punctuation-probe.ts removed.
  • No ulw-qa/WI-5 tmux session, browser context, server, or container was left running.

Plan: plans/port-gajae-3day-remaining-optimizations.md


Summary by cubic

Adds a conservative fast path for single-line intra-line diffs in the coding agent to speed up rendering while keeping output identical. Implements WI-5 with ~64% median improvement in the word-diff suite.

  • New Features

    • Fast path for identical lines and single-span ASCII word replacements (incl. long lines); otherwise falls back to Diff.diffWords.
    • Added parity and no-diffWords tests, plus a word-diff benchmark and baseline wired into scripts/run-pr530-benchmarks.mjs.
  • Bug Fixes

    • Fixed punctuation-adjacent replacement highlighting by limiting the fast path to ASCII word tokens and adding a regression test.

Written for commit 2e9ee8b. Summary will update on new commits.

Review in cubic

Plan: plans/port-gajae-3day-remaining-optimizations.md
@code-yeongyu code-yeongyu merged commit 1da1ab5 into main Jun 15, 2026
4 of 5 checks passed
@code-yeongyu code-yeongyu deleted the perf/diff-intraline-fastpath branch June 15, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant