perf: trim hot-path allocations in indexing and TUI render#77
Merged
Conversation
amittamari
force-pushed
the
oxc-inspired-phase2
branch
from
July 12, 2026 14:00
6ef08ea to
671fb41
Compare
amittamari
force-pushed
the
oxc-inspired-phase1
branch
from
July 12, 2026 14:17
88d922a to
32e0099
Compare
amittamari
force-pushed
the
oxc-inspired-phase2
branch
from
July 12, 2026 14:18
671fb41 to
b4346ed
Compare
Concrete, std-only allocation cleanups (no new dependencies): - Adapters: reuse one decode buffer per file instead of allocating a fresh Vec<u8> for every JSONL line (clear + extend_from_slice). Applies to the Claude, Codex, and Cursor parse loops. - Results list: compute each visible cell's (text, style) once per frame via `compute_cells`, then feed the same grid to both the width solver (`layout_from_cells`) and the row builder (`session_row`). Previously every non-flex cell string was built twice per frame (measure pass + build pass). This also halves the per-frame `document_key()` probes for the PR column and lets `cell()`/`enrichment_cell()` take `&RowCtx`, dropping the `too_many_arguments` allow. - Footer: build the status line once and size its region from it instead of rebuilding it just to measure the width (`line_display_width`). - Return `Cow<str>` from the no-op-common text transforms so they borrow when the input is unchanged (the common case): `strip_codex_wrappers`, `strip_redacted` (now fully allocation-free), and index `sanitize`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
amittamari
force-pushed
the
oxc-inspired-phase2
branch
from
July 13, 2026 05:46
b4346ed to
f6a452e
Compare
Merged
amittamari
added a commit
that referenced
this pull request
Jul 13, 2026
## 🤖 New release * `hop`: 0.2.8 -> 0.2.9 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.2.9](v0.2.8...v0.2.9) - 2026-07-13 ### Added - capture session model/commit and skip non-interactive threads ([#75](#75)) - harden Codex session parsing ([#74](#74)) - simple/raw search modes with guided toolbar ([#73](#73)) - hook-based session metadata enrichment ([#65](#65)) ### Other - trim hot-path allocations in indexing and TUI render ([#77](#77)) - adopt edition 2024, in-tree lint policy, and rustfmt config ([#76](#76)) - add DESIGN.md, codex-inspired review, and no-local-paths rule - *(readme)* update demo </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
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.
Concrete, std-only allocation cleanups in the indexing parse loop and the TUI render path. No new dependencies.
Changes
Vec<u8>for every JSONL line (clear+extend_from_slice). Applies to the Claude, Codex, and Cursor parse loops.(text, style)once per frame (compute_cells), then feed the same grid to both the width solver (layout_from_cells) and the row builder (session_row). Previously every non-flex cell string was built twice per frame (measure pass + build pass). This also halves the per-framedocument_key()probes for the PR column and letscell()/enrichment_cell()take&RowCtx, dropping thetoo_many_argumentsallow.line_display_width).Cow<str>for the no-op-common text transforms so they borrow when the input is unchanged (the common case):strip_codex_wrappers,strip_redacted(now fully allocation-free), and indexsanitize.Note
Full elimination of the per-frame
document_key()format!was intentionally not pursued: theresolvedmap's(String, &'static str)tuple key can't be probed with a borrowed key, so even a cached key would still clone into the tuple. Removing it entirely would require restructuring the map type across its construction sites and ~15 tests for negligible gain. The grid change above already halves the calls.Verification
cargo fmt --all -- --checkcleancargo clippy --all-targets --all-features -- -D warningscleancargo test— 277 pass. Adapter/index integration suites cover the parse-path andCowchanges;results_listunit tests andview.rsrender-to-buffer snapshots cover the render-path changes.🤖 Generated with Claude Code