Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix very laggy Sources tab in DevTools when using "Patch all" in Spacepack #214

Merged
merged 3 commits into from
Feb 13, 2025

Conversation

uwx
Copy link
Contributor

@uwx uwx commented Feb 7, 2025

The problem: DevTools Sources tab is incredibly laggy
The cause: Using "Patch all" creates hundreds of thousands of modules in one directory which is a lot to render in the sidebar and the list isn't virtualized
The solution: Group patched webpack modules by the first 3 chars of the ID, reducing the amount of rendered files in the sidebar

Also my moonbase disappeared but I reverted my changes and it's still gone so maybe unrelated? I need to test if the crash screen works properly but I can't install Crash Me right now. it was my fault

uwx added 2 commits February 7, 2025 20:06
…t it does not make the debugger unusably laggy when using "patch all modules" in spacepack
@uwx uwx marked this pull request as ready for review February 8, 2025 00:44
@uwx
Copy link
Contributor Author

uwx commented Feb 8, 2025

crashScreen is working, PR is now ready for review.
DiscordCanary_2025-02-07_21-43-00

@NotNite
Copy link
Member

NotNite commented Feb 12, 2025

I'm worried about merging something like this because of potential breakage of other things around the ecosystem, but this seems small enough that it's probably fine.

@uwx
Copy link
Contributor Author

uwx commented Feb 12, 2025

I'm worried about merging something like this because of potential breakage of other things around the ecosystem, but this seems small enough that it's probably fine.

Definitely aware, but I've been rolling with this patch for a few days now and nothing terrible has happened (besides crash screen which had to be fixed, obviously)

@Cynosphere
Copy link
Member

I think it would just be better to split on the boundary of "Webpack-Module" instead of the first 3 of the module ID.

@uwx
Copy link
Contributor Author

uwx commented Feb 12, 2025

I think it would just be better to split on the boundary of "Webpack-Module" instead of the first 3 of the module ID.

How do you mean? The thing that causes the performance issue is the fact that all the modules are in "the same directory" as far as DevTools sees it. So it needs to be keyed somehow.

@Cynosphere
Copy link
Member

It's something we can't truly solve because its an upstream issue we're merely trying to work around. Any and all solutions are not going to be desireable.

I guess a better solution would be something close to how most hashed object storage works where it usually splits by the first two into a folder instead of splitting the entire string where it could lead to confusion

@uwx
Copy link
Contributor Author

uwx commented Feb 12, 2025

it usually splits by the first two into a folder instead of splitting the entire string where it could lead to confusion

So instead of Webpack-Module-123/12345 you want 123/Webpack-Module-12345? That can be done

@Cynosphere
Copy link
Member

I was under the assumption it was splitting like Webpack-Module-123/45. But in my specific example I would just add another / so its Webpack-Module/123/12345

@uwx
Copy link
Contributor Author

uwx commented Feb 13, 2025

Did the requested changes, should be good now

@uwx
Copy link
Contributor Author

uwx commented Feb 13, 2025

By the way, have an idea of how the DevTools Sources tab looks with these patches:
DiscordCanary_2025-02-13_13-17-04

@Cynosphere Cynosphere merged commit cb34ba0 into moonlight-mod:develop Feb 13, 2025
1 check passed
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.

3 participants