Repository navigation
⚡ Bolt: optimize version comparison and installed mod list sorting - #312
google-labs-jules[bot] wants to merge 1 commit into
Conversation
|
👋 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. |
💡 What:
localeComparewith options calls inInstalledPage.tsxwith a shared module-levelIntl.Collatorinstance (nameCollator) and direct comparison fallback.compareVersionsinsrc/lib/format.tsby adding an identity check (a === b) and single-pass character code parsing of version segments, completely eliminating intermediate array allocations (.split()and.map()).🎯 Why:
a.name.localeCompare(b.name, undefined, { sensitivity: "base" })inside an array sort comparator causes JS engines to instantiate and configure a newIntl.Collatoron every single pairwise comparison. For hundreds of installed mods, this causes significant CPU overhead and garbage collection churn during rendering and tab switches.compareVersionsis invoked frequently across version lists and changelog filtering. Allocating multiple temporary arrays on every version comparison contributes unnecessary heap allocations and GC latency.📊 Impact:
🔬 Measurement:
pnpm build(tsc && vite build) and full Rust backend test suite (cargo test --manifest-path src-tauri/Cargo.toml).PR created automatically by Jules for task 9735258893728318902 started by @TheDragonSoft