Repository navigation
⚡ Bolt: [performance improvement] Optimize FileList.jsx render loop complexity - #27
TheerasakPing wants to merge 2 commits into
Conversation
…omplexity Refactor O(N*M) array iteration lookups into O(N) Set lookups during render loop. Co-authored-by: TheerasakPing <185220419+TheerasakPing@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Added `use crate::log_info;` to tests mod in `src-tauri/src/commands/volume_operations_commands.rs` to fix macro resolution during cargo test. Co-authored-by: TheerasakPing <185220419+TheerasakPing@users.noreply.github.com>
💡 What:
Optimized the render loop in
FileList.jsxby replacing O(M)Array.prototype.somesearches inside the.mapiteration with O(1)Set.haslookups. CreatedselectedPathsandcutPathsSets memoized viauseMemo.🎯 Why:
For each item in
sortedItems(N), the component was iterating throughselectedItems(M1) andclipboard.items(M2). This created an O(N * (M1+M2)) complexity during the critical render phase, causing noticeable frame drops and slow interactions when navigating directories with hundreds or thousands of files with many files selected.📊 Impact:
Reduces the computational complexity of rendering the file list from O(N*M) to O(N). This makes rendering virtually constant time with respect to the number of selected/cut items, eliminating UI jank when selecting multiple files in large directories.
🔬 Measurement:
FileListrender time scaled linearly with selection size. After this change, it scales only with the visible/total items length.PR created automatically by Jules for task 12768537958252469048 started by @TheerasakPing