Repository navigation
⚡ Bolt: Reuse module-level Intl.Collator in InstalledPage sort - #144
TheDragonSoft wants to merge 1 commit into
Conversation
In InstalledPage, sorting enabled and disabled installed mods called localeCompare with options on every element comparison. This created temporary Intl.Collator instances repeatedly during sort(), adding ~30ms of main-thread overhead for large mod lists. Reusing a single module-level Intl.Collator instance eliminates repeated collator instantiations and allocation overhead during mod list sorting. Co-authored-by: TheDragonSoft <75906592+TheDragonSoft@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. |
💡 What: Reused a module-level Intl.Collator instance (
modNameCollator) inInstalledPage.tsxsorting comparator instead of invokinga.name.localeCompare(b.name, undefined, { sensitivity: "base" }).🎯 Why: In V8/Chromium, passing options to
localeComparecreates a newIntl.Collatorinstance on every comparison. In mod lists with 100+ mods,sort()invokes the comparator hundreds of times, resulting in ~30ms of synchronous main-thread blocking time and GC pressure.📊 Impact: Reduces sorting time on InstalledPage from ~30ms to <0.1ms and avoids creating hundreds of transient
Intl.Collatorobjects on every sort execution.🔬 Measurement: Tested with
pnpm buildandcargo test --manifest-path src-tauri/Cargo.toml.PR created automatically by Jules for task 14672117375073654949 started by @TheDragonSoft