Skip to content

Input latency profiler + recorder + baseline (review-only) - #4

Open
hitpopdimestop wants to merge 15 commits into
mainfrom
codex/input-latency-profiling
Open

Input latency profiler + recorder + baseline (review-only)#4
hitpopdimestop wants to merge 15 commits into
mainfrom
codex/input-latency-profiling

Conversation

@hitpopdimestop

Copy link
Copy Markdown
Owner

Review-only PR against my fork so the profiling work is easy to read as a single diff. Not intended for upstream as-is (upstream tracking is issue superdoc#3842).

What this branch adds

An opt-in, zero-by-default input-latency profiler for the presentation editor, plus a reproducible browser recorder/comparator and a captured baseline. No product behavior changes unless profiling is explicitly enabled.

Instrumentation (packages/super-editor)

  • InputLatencyProfiler (presentation-editor/performance/) — created only when SD_DEBUG_INPUT_LATENCY / __SD_DEBUG_INPUT_LATENCY__ is set. Correlates beforeinput → transaction → coalesced render → per-phase layout → DOM paint → next frame and emits standard User Timing measures. When disabled it allocates nothing (one null check at each call site).
  • PresentationInputBridge — one synchronous hook for an eligible visible beforeinput (including input that lands on the focused hidden editor).
  • PresentationEditor — records the transaction, render coalescing, per-phase timings, DOM paint, and the following animation frame; cleans up on destroy.
  • Next-frame time is read with performance.now() in the rAF callback (not the frame-start argument), so there are no physically-impossible next-frame < DOM-paint samples.

Dev tooling (devtools/input-latency/, dev-only, alongside word-benchmark-sidecar)

  • profile.mjs — Playwright recorder: fixed protocol (1 warm-up + 5 measured runs of 40 chars @100Ms across normal / 4×-CPU / layout-off), fixture SHA verification, full trace/discard metadata, strict completeness validation before write.
  • report.mjs / report.test.mjs — deterministic statistics, fingerprinting, comparison, and report-completeness validation (unit-tested).
  • compare.mjs — strict comparison CLI with a materiality rule (max(5ms, 2×MAD)).
  • README.md — exact record/compare workflow. Raw reports live under results/ and are gitignored.

How to review

Notes

  • pnpm-workspace.yaml bumps playwright catalog to ^1.60 (Node 24.16 extract-zip install hang); pnpm-lock.yaml picked up some incidental @types/node drift that would be cleaned before any upstream submission.
  • Package type-check has a large pre-existing failure baseline in this repo; these changes add no new type errors.

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