Skip to content

⚡ Bolt: [performance improvement] Optimize Selection and Clipboard State Checks in FileList - #28

Open
TheerasakPing wants to merge 3 commits into
mainfrom
bolt-optimize-filelist-selection-7744120107825252104
Open

TheerasakPing wants to merge 3 commits into
mainfrom
bolt-optimize-filelist-selection-7744120107825252104

Conversation

@TheerasakPing

Copy link
Copy Markdown
Owner

💡 What: Replaced .some() loops on arrays with O(1) Set lookups using useMemo for calculating isSelected and isCut attributes in FileList.jsx.
🎯 Why: In directories with high file counts (large N) and multiple selected/cut items (large M), the .some() check inside the .map() loop caused an O(NM) time complexity bottleneck, degrading frontend rendering performance.
📊 Impact: Reduces complexity of determining item states during render from O(N
M) to O(N+M), drastically reducing re-render time in populated directories.
🔬 Measurement: Render time of FileList component with large simulated collections when clicking to select multiple items.


PR created automatically by Jules for task 7744120107825252104 started by @TheerasakPing

Replaced O(N) array `.some()` lookups with O(1) `Set` lookups inside the
`FileList.jsx` rendering map. This changes the rendering complexity from
O(N*M) to O(N+M) for determining `isSelected` and `isCut` states, resulting
in measurably faster renders for directories with a large number of files.

Co-authored-by: TheerasakPing <185220419+TheerasakPing@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits March 10, 2026 11:45
… failure

Addressed multiple issues causing CI pipelines to fail with exit code 101:
- Imported missing `log_info` macro in `volume_operations_commands.rs` tests.
- Conditionally compiled `std::process::Command` in `permission_commands.rs` to fix `unused_imports` on non-macOS targets.
- Removed unused `Manager` import from `state/mod.rs`.
- Added `#[allow(unused_assignments)]` to variables only used within `#[cfg]` logging blocks in `search_core.rs` to eliminate warnings treated as errors.

Co-authored-by: TheerasakPing <185220419+TheerasakPing@users.noreply.github.com>
To resolve the failing `cargo test` checks where `#[warn(unused_assignments)]` was being denied and stopping the build:
- Added `#[allow(unused_assignments)]` inside block scopes around `removed_count += 1;` and `added_fuzzy += 1;` inside `src-tauri/src/search_engine/search_core.rs`.
- These variables are effectively only read inside conditionally compiled feature-flag logging blocks (`#[cfg(feature = "index-progress-logging")]` and `#[cfg(feature = "search-progress-logging")]`). When those features are off (default), the variables are written to but never read, causing the warning.

This allows CI to finish compiling clean of warnings and process the frontend performance improvements PR.

Co-authored-by: TheerasakPing <185220419+TheerasakPing@users.noreply.github.com>
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