Skip to content

docs(research): close filter-text perf-fix investigation (PRs #142-146)#147

Open
blove wants to merge 1 commit into
mainfrom
filter-text-investigation-closeout
Open

docs(research): close filter-text perf-fix investigation (PRs #142-146)#147
blove wants to merge 1 commit into
mainfrom
filter-text-investigation-closeout

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 18, 2026

Summary

Closes the wrapped-text filter perf-fix investigation thread (PRs #142, #143, #144, #145, #146) without a production code fix.

Why no fix

With the full diagnostic pipeline now in place (CDP tracing + sourcemaps + interaction-window slicing), single-trace data for `pretable / S2 / hypothesis / filter-text` shows:

n=1 single trace PR #134 n=20 p95
Interaction window ~6-8 ms 16.79 ms
In-window scripting ~5 ms (not directly comparable)
Top hotspot (`matchesFilters`) ~0.7 ms

The ~10 ms gap between single-trace and p95 is in paint/composite/native browser work that the V8 CPU profiler doesn't fully attribute. Even reducing the entire `matchesFilters` cost to zero would only get filter-text to ~16.0-16.2 ms — still grazing the 16 ms single-frame budget.

A `WeakMap<row, lowercase-cell>` cache for `matchesFilters` would help real-world multi-character typing but not the single-trigger bench scenario. It can ship as a small standalone PR if real-user UX is the motivation, but framing it as "fixing the bench miss" would be misleading.

What this investigation produced

PR What landed Status
#142 Diagnostic memo; identified harness gap merged
#143 Opt-in CDP tracing (`PLAYWRIGHT_PERF_TRACE=1`) merged
#144 `waitForTrigger=1` gate for proper window capture merged
#145 First flame-graph + `analyze-cdp.mjs` + bench sourcemaps; misattributed F8 from full-trace view merged
#146 `performance.mark` bounds + `--window=interaction` slicing; corrected #145; identified `matchesFilters` merged
#147 (this PR) Closeout memo open

The infrastructure is production-ready and reusable for any future bench-perf investigation.

Lessons captured (in repo memory)

  1. Always slice to the interaction window before naming a hotspot. Full-trace top-N is dominated by mount-time work.
  2. Single-trace n=1 is not enough for borderline budget misses. When the bench reports a tight σ and a 1ms miss, a single CDP trace will show only ~half the actual p95 latency due to variance + paint costs not captured in scripting.
  3. CDP scripting traces alone don't explain bench latency for fast operations dominated by paint/composite. Reaching paint costs requires either capturing n≥20 traces with aggregation, or shifting to a different kind of investigation.

Recommended next steps (for anyone who returns)

  • Capture n≥20 CDP traces and aggregate per-frame timing if the goal is to close the 1ms gap.
  • Shift focus to settling/paint/DOM-node reduction, not scripting.
  • Ship the `WeakMap` cache for matchesFilters as a real-world-only PR if live-typing UX is the motivation.

Gates

  • Memo only — no code changes
  • Quality wedge untouched
  • `pnpm format` clean

🤖 Generated with Claude Code

After the full diagnostic pipeline (CDP tracing → trigger gating →
sourcemaps → interaction-window slicing), single-trace data shows
in-window scripting for filter-text is ~5 ms, of which the leading
hotspot (`matchesFilters`) is ~0.7 ms. PR #134's n=20 p95 is
16.79 ms; the ~10 ms gap is in paint/composite/native browser work
that scripting fixes can't move. Even eliminating matchesFilters
entirely would only get filter-text to ~16.0-16.2 ms — still grazing.

Investigation closed. Infrastructure (analyzer, sourcemaps, slicing,
markers) is production-ready and reusable. Homepage prose (PR #141)
accurately reflects state: real-but-over-budget; pretable 2-3.5×
faster than every comparator.

Memory updated with the lesson that single-trace n=1 is not enough
for borderline budget misses.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@blove blove enabled auto-merge (squash) May 18, 2026 19:53
@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pretable Ready Ready Preview, Comment May 18, 2026 7:54pm

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