Repository navigation
perf(bench): recalibrate paste_multiline_bench to the #252 PasteChunkEditMode contract - #261
Merged
Merged
Conversation
…EditMode contract The bench still measured the pre-#252 world and its elapsed number mixed path cost with harness artifacts: - Default payload was synthetic/200; the calibrated workload is the issue202 author payload (257-line fixture, >300 s -> ~4.6 s, CHANGELOG 1.4.0). issue202 is now the default. - The bracket flavor timed a path that does not exist on Windows: ConPTY swallows the ?2004/?201~ markers (crossterm#737), so a bracketed paste through ConPTY exercised the same raw per-line feed as raw — a duplicate datapoint under a misleading name (#252 is the Windows replacement for bracketed paste; Unix keeps #234's Event::Paste and never runs the heuristic). The bench feeds exactly one shape now: the raw Ctrl+V burst. - elapsed smeared in a fixed 0.3 s quiet drain and up to 1 s of retry quantization with nothing separating them from the path. The drain is now reported as settle_wait (path-vs-harness split), enters_sent counts absorbed submit attempts, and the harness cadence (0.3 s settle, 1.0 s Enter resend) is a documented contract so elapsed stays comparable with the CHANGELOG ~4.6 s reference. - Bare-line marker matching is incremental (new chunks + carried tail) instead of rescanning the whole accumulator every poll tick, so the harness's own CPU cannot distort timing on a regressed high-output path. - Output now carries provenance: the niu --version banner (build rev), niubash rev, OS/python/pywinpty, payload stats (pasted lines vs the 257-line fixture — the post's trailing blank lines are not paste data) and the exact repro command. --json emits one object per case for CI. Windows-only by nature (cfg(windows) code under test, pywinpty/ConPTY driver): non-Windows runs now explain and exit 2 instead of failing on the import. CI shape is the existing windows-latest + pywinpty setup the perfbudget-trend job already uses; documented in the module docstring. Verified against a fresh build of master (11c1612): issue202 elapsed 4.58-4.60 s (CHANGELOG ~4.6 s), bad_executions_paste 0, bytes_out ~3.7 KB; synthetic/200 elapsed 3.98 s, bad_executions_total 199 (one execution of the submitted script, by design).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#252 (PasteChunkEditMode) is merged;
scripts/perf/paste_multiline_bench.pystill measured the pre-#252 world, so its numbers no longer meant anything:synthetic/200 lines. The calibrated workload is the issue202 author payload — the 257-lineset -euo pipefailbuild script whose end-to-end wall time defines the repl: PSReadLine-style paste-chunk detection for the Windows console path #252 claim (>300 s timeout → ~4.6 s, CHANGELOG 1.4.0). A naive bench run never reproduced the calibration number.bracketflavor (defaultboth) implied the repl: enable bracketed paste for GNU bash multiline-paste semantics (#202) #234 bracketed-paste path — but ConPTY swallows the?2004/?201~markers (crossterm#737, cited in repl: PSReadLine-style paste-chunk detection for the Windows console path #252), so on Windows a "bracketed" paste through ConPTY exercises the same raw per-line feed asraw. Its timing was a duplicate datapoint under a misleading name. (Unix keeps realEvent::Pasteand never runs the heuristic — this bench is Windows-only by nature.)elapsedmixed path cost with harness artifacts. A fixed 0.3 s quiet drain before the submit and up to 1.0 s of Enter-retry quantization sat insideelapsedwith nothing separating them from the paste path. On the healthy path the paste is silent (the chunk stays pending until the user's Enter), so the drain was a guaranteed dead-time tax; on a regressed path it could swallow up to 30 s.Fix
issue202is the default payload; the CHANGELOG-calibrated number is what a default run measures.bracketflavor removed with the reasoning recorded in the module docstring.SETTLE_QUIET=0.3 s,ENTER_RESEND=1.0 s) soelapsedkeeps its meaning — the CHANGELOG ~4.6 s reference was measured with exactly this cadence. New fields split the number:settle_wait(pure harness wait before the synthetic user's first Enter) andenters_sent(absorbed submit attempts).niu --versionbanner (build rev), niubash rev, OS/python/pywinpty versions, payload stats (pasted lines vs the 257-line fixture — the post's trailing blank lines are not paste data) and the exact repro command.--jsonemits one object per case for CI consumption.perfbudget-trendjob already uses (documented in the docstring).The #202 defect gate is unchanged:
bad_executions_pastemust be 0 (bareBAD<n>output lines while the paste is still arriving; echoed edit-buffer text does not count) and the marker must execute within--timeout(default 300 s — the ">300 s" calibration bound).Verified (fresh
cargo buildof master 11c1612, Windows 10 19045, Python 3.14.7, pywinpty 3.0.5)elapsed4.58–4.60 s across three runs — the CHANGELOG's ~4.6 s reference reproduces on the merged repl: PSReadLine-style paste-chunk detection for the Windows console path #252 path.bad_executions_total=199— the submitted script executed exactly once, matching the "approaches the payload size by design" semantics.Closes the bench-calibration follow-up of #252. No product code touched.