Skip to content

fix(perf): count no-op keys the same way in both frontends - #83

Merged
piny4man merged 1 commit into
mainfrom
perf/probe-noop-keys
Oct 17, 2026
Merged

piny4man merged 1 commit into
mainfrom
perf/probe-noop-keys

Conversation

@piny4man

Copy link
Copy Markdown
Owner

NUKE-114. On Rio, a key that changes nothing on screen (for example Backspace on an empty query) left its HYPRBURST_PERF sample pending until the next key's frame. The sample then read as one typing pause, 110–760 ms. Native marked every keyed frame as changed, so it never folded keys this way.

Changes

  • One answer rule: in both frontends, only a frame with a visible change answers an input. Native compares each frame's cells with the previous frame's (LastFrame in src/gpu/window.rs). The comparison runs only while the probe is on, so normal runs pay nothing.
  • Expiry: a pending input expires when the next key arrives more than 50 ms later (INPUT_EXPIRY in src/perf.rs). It is printed as query-input-unanswered / selection-input-unanswered <frontend> <age>, and the new key starts its own sample. Bursts within 50 ms still fold into their first key.
  • Why a time rule: the finding proposed dropping a sample "after one refresh with no damage", but that can't work on Rio. A no-op key makes the child send no PTY bytes, so there is no wake to time it out on.
  • Docs: docs/hotpath-profiling.md describes the rule and the new metrics. docs/hotpath-findings.md marks finding 5 fixed and adds an "After NUKE-114" section. It also corrects the finding: Up on the first row wraps, so it isn't a no-op.

Results

Live sessions in performance mode, typed manually:

Rio query max Answered samples > 20 ms
Before (c777c0a) 760 ms 1 (a no-op key)
After 1.33 ms 0
  • No-op round: a targeted round (Backspace ×3 on an empty query, f, Backspace) gives the same result in both frontends: 3 unanswered lines plus 2 answered samples under 1 ms.
  • Medians: unchanged on Rio. Native's rise ~0.06 ms, from the probe-only comparison.
  • Done-when: met.

Validation

  • cargo fmt --check.
  • Clippy with -D warnings, default features and --all-features.
  • cargo build --all-targets.
  • cargo test --all-targets with default, hotpath and hotpath-alloc features: 341 / 342 / 342 passed.
  • New tests cover expiry, folding at the boundary, slow frames still being reported, the unanswered metric names, and the native frame-change check.

A key that changes nothing on screen (Backspace on an empty query) left
its HYPRBURST_PERF sample pending on Rio until the next key's frame, so
it read as one typing pause (110-760 ms). Native marked every keyed
frame as changed and never folded keys this way.

Both frontends now answer an input only with a visible change; native
compares each frame's cells with the previous one while the probe is
on. A pending input expires when the next key arrives more than 50 ms
later and is printed as *-input-unanswered with its age. Bursts within
50 ms still fold into their first key.

The rule is checked at the next key, not after one refresh with no
damage: a Rio no-op key sends no PTY bytes, so there is no wake to time
it out on.
@piny4man
piny4man merged commit d703172 into main Oct 17, 2026
1 check passed
@piny4man
piny4man deleted the perf/probe-noop-keys branch October 17, 2026 10:29
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