Skip to content

perf: Phase 2 rendering & cache optimizations#54

Merged
tzero86 merged 2 commits into
mainfrom
feat/render-optimizations
May 13, 2026
Merged

perf: Phase 2 rendering & cache optimizations#54
tzero86 merged 2 commits into
mainfrom
feat/render-optimizations

Conversation

@tzero86

@tzero86 tzero86 commented May 13, 2026

Copy link
Copy Markdown
Owner

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 repeated to_lowercase() allocations during sorting and filtering
  • rebuild_cache(): reuses filtered_indices Vec via clear() + extend() instead of replacing it on every rebuild
  • Pre-allocated rest_indices capacity avoids reallocation during partition

Rendering Hot Path

  • REPEAT_CACHE: static lookup table (0–128 chars) for spaces, bars (), and shades () — eliminates per-frame string allocations in:
    • pane row spacers
    • progress bar
    • filter strip padding
    • preview gutter
    • status bar padding
  • Progress bar: builds a single pre-allocated String instead of nested format!(..., repeat(), repeat())
  • render_status_bar: pre-allocates Vec<Span> with capacity 6

String/Path Optimizations

  • selected_path() returns Option<&Path> instead of Option<PathBuf> — frame-rate callers no longer clone; marks only clone at insert/remove time

Validation

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo clippy --no-default-features --tests -- -D warnings
  • cargo test --workspace (630+ tests pass)

Branch: feat/render-optimizations
Based on: main

- 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/ui/mod.rs Outdated
@tzero86 tzero86 merged commit 0d1a9cf into main May 13, 2026
6 checks passed
@tzero86 tzero86 deleted the feat/render-optimizations branch May 13, 2026 12:08
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