Skip to content

perf(terminal): reduce search and frame update overhead - #65

Merged
simota merged 1 commit into
mainfrom
perf/search-render-updates
Sep 5, 2026
Merged

perf(terminal): reduce search and frame update overhead#65
simota merged 1 commit into
mainfrom
perf/search-render-updates

Conversation

@simota

@simota simota commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Search highlighting scans all matches for each rebuilt row, query scans allocate scratch buffers per row, and partial redraws copy unchanged pane instances. Synchronized output also deep-copies held frames. Reduce this repeated work while preserving Unicode search positions, navigation, and rendered pixels.

  • Use binary search to select matches on a requested row and reuse query text/byte-to-column buffers.
  • Retain unchanged pane instances and carry pending changed ranges through to GPU upload, including multiple rebuilds without a draw. Remove the full CPU shadow of the GPU buffer.
  • Share immutable snapshot rows with Arc<Vec<Row>>, preserving independent display metadata and allocation reuse when ownership is unique.

Validation

  • cargo build --workspace --locked --offline
  • cargo fmt --all -- --check
  • cargo test --workspace --locked --offline -- --test-threads=1 — 2,499 passed, 15 ignored.
  • cargo test -p noa-grid -p noa-render --release --lib performance_probe --locked --offline -- --ignored --nocapture — three paired runs.
  • Regression coverage includes Unicode/combining text, four-pane updates and layout changes, pending uploads, held-frame isolation, 200-frame GPU pixel equivalence, and 40 renderer pipeline tests.

Measurements

Local arm64 macOS 26.6.2, release build; medians of three isolated runs:

Operation Prior mechanism New mechanism
Search 日本, 20,000 rows 27.486 ms 15.137 ms
Search space, 20,000 rows 49.311 ms 21.274 ms
Match-row lookup, 100,000 matches 126.629 ms 0.212 ms
Snapshot clone, 200x50, 2,000 copies 14.807 ms 0.245 ms

These measure the local mechanisms rather than application frame rate or end-to-end input latency. Search remains synchronous. Full conditions and results are in docs/performance-measurements.md.

Review notes

FrameSnapshot.rows now uses Arc<Vec<Row>>; workspace constructors and the benchmark consumer are updated. Pending uploads and snapshot ownership are covered by regression tests; no configuration or persisted format changes are required.

The unchanged PTY test reader_reuses_returned_payload_buffers failed once in a parallel workspace run, then passed both an isolated rerun and the complete serial run. Its stabilization is recorded as a separate follow-up in the measurement log.

Reduce allocation and copying during scrollback search and incremental
redraws by reusing query scratch space, retaining pane instances, and
sharing snapshot rows. Preserve Unicode match positions and rendered
output with regression coverage.

Validation: workspace build and formatting checks pass; the serial
workspace run passes 2,499 tests. Record release measurements and the
existing intermittent PTY buffer-reuse test in the performance log.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T00:53:02.161266Z d7524f9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@simota
simota merged commit 03bb7e8 into main Sep 5, 2026
1 check passed
@simota
simota deleted the perf/search-render-updates branch September 5, 2026 15:59
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