Skip to content

Load the online mod list from a flat summary table#2192

Open
ethangreen-dev wants to merge 2 commits into
developfrom
fix-package-index-load-perf
Open

Load the online mod list from a flat summary table#2192
ethangreen-dev wants to merge 2 commits into
developfrom
fix-package-index-load-perf

Conversation

@ethangreen-dev

@ethangreen-dev ethangreen-dev commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

The what?

getPackagesAsThunderstoreMods (great name) scanned the full packages table, forcing indexdb to deserialize every version[] (like 188k in total, about 310MB on lethal-company) just to build a flat per-package list. This caused insane slowdowns at launch, especially for users on underpowered PCs. Also the memory usage was just bad.

The fix?

Add a summaries table that holds only the fields the list needs. The list read scans it and ignores versions[], while keyed lookups still work the same way.

The performance?

The lethal-company index, as reported by my benchmarks, had a cold read time reduction from ~2.5s to ~0.5s and peak allocation reduction from ~400MB to ~25MB.

getPackagesAsThundersstoreMods (great name) scanned the full packages
table, forcing indexdb to deserialize every version[] (like 188k in
total, about 310MB on lethal-company) just to build a flat per-package
list. Add a summaries table that holds only the fields the list needs.
The list read scans it and ignores versions[], while keyed lookups still
work the same way.

lethal-company my benchmarks report a cold read from ~2.5s to ~0.5s and
peak allocation reduction from ~400MB to ~25MB.
@ethangreen-dev ethangreen-dev requested a review from ebkr June 7, 2026 00:08
markRaw makes state.mods a non-reactive object, so ImportProfileModal
watching the array directly becomes an invalid, inert watch source. Watch
a getter instead, which fires on the wholesale reassignment that a mod
list refresh performs.
@ethangreen-dev ethangreen-dev force-pushed the fix-package-index-load-perf branch from 45b68ea to 9467639 Compare June 7, 2026 05:11

@ebkr ebkr left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved but check comments

.sort(ThunderstoreMod.defaultOrderComparer);
let summaries = await db.summaries.where({community}).toArray();

if (!summaries.length) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This should be a length comparison - a boolean check whilst valid is incorrect comprehension vs just an assertion to 0

Comment on lines +160 to +162
// The mod list is large and immutable, replaced wholesale.
// markRaw keeps Vue from deep-proxying every entry, which absolutely dominates
// the load memory and time complexity.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think you'll find this has a large impact only in VueX development mode.

If you go to store/index.ts, and turn off strict mode, does this actually make much of a difference?

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.

2 participants