perf: Phase 2 rendering & cache optimizations#54
Merged
Conversation
- Cache lower_name in EntryInfo at construction time; eliminates per-sort to_lowercase() allocations in rebuild_cache and archive listing sorts. - Reuse filtered_indices Vec in rebuild_cache via clear()+extend() instead of replacing it on every cache rebuild. - Pre-allocate Vec capacities in rebuild_cache and render_status_bar. - selected_path() now returns Option<&Path> to avoid clones in frame-rate callers (debug panel, state dispatch). Mark mutations clone only when actually inserting/removing. - Add REPEAT_CACHE static lookup for space/bar/shade strings up to 128 chars, eliminating per-frame allocations for pane spacers, progress bars, filter strips, preview gutters, and status padding. - Progress bar in render_status_bar builds a single pre-allocated String instead of nested format! allocations.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3247483522
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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.
Summary
Phase 2 of the implementation plan: rendering hot-path and cache optimizations to reduce per-frame allocations and improve scrolling responsiveness.
Changes
Pane Cache Rebuild
EntryInfo.lower_name: cached at construction time; eliminates repeatedto_lowercase()allocations during sorting and filteringrebuild_cache(): reusesfiltered_indicesVec viaclear()+extend()instead of replacing it on every rebuildrest_indicescapacity avoids reallocation during partitionRendering Hot Path
REPEAT_CACHE: static lookup table (0–128 chars) for spaces, bars (─), and shades (░) — eliminates per-frame string allocations in:Stringinstead of nestedformat!(..., repeat(), repeat())render_status_bar: pre-allocatesVec<Span>with capacity 6String/Path Optimizations
selected_path()returnsOption<&Path>instead ofOption<PathBuf>— frame-rate callers no longer clone; marks only clone at insert/remove timeValidation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo clippy --no-default-features --tests -- -D warningscargo test --workspace(630+ tests pass)Branch:
feat/render-optimizationsBased on:
main