misode / misode.github.io

Data Pack Generators and Tools for Minecraft 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21
https://misode.github.io/
MIT License
588 stars 78 forks source link

The website freezes for 10-15 seconds on fresh start #649

Open benazarenko opened 3 days ago

benazarenko commented 3 days ago

Hello. Two days ago I tried to open the entity tag generator page and at some point it freezed for ~15 seconds. I'm sure it never happened before. I was using the same page 2 weeks ago and it was good. Website inspector shows me that all this time takes to load bind files.

[Profiler: project#ready] List URIs        - 2024 ms
[Profiler: project#ready] Register Symbols - 963 ms
[Profiler: project#ready] Pop Errors       - 0 ms
[Profiler: project#ready] Validate Cache   - 1 ms
[Profiler: project#ready] Bind URIs        - 97 ms
[Profiler: project#ready] Sort URIs        - 0 ms
[Profiler: project#ready] Bind Files       - 11869 ms
[Profiler: project#ready] Total            - 14954 ms

As I can see, it loads a lot of archived data during bind files task. I have no idea what's happening there (logs give me a lot of tar.gz archive jobs), but 12 seconds is a lot. And this is not a problem with internet. I asked my friend to load the website in incognito mode, and got the same result. Same happens when using a VPN.

As I tried to dig in, I can 90% be sure it's not an internet issue. The tar.gz archive it downloads is ~172KB large. Looks like the problem is binding.

archive://vanilla-mcdoc.tar.gz/java/assets/item_definition.mcdoc                     - 5208 ms

The item_definition.mcdoc file is ~11KB large, and extracting it should not take 5s. There is something else.

There is something very performance consuming that takes 12 seconds to load the page without cached files.

misode commented 13 hours ago

I'm aware of some performance problems after the rewrite. After having the website open for 10 seconds after it has loaded, it should cache the results in your browser, so consecutive loads should be a lot faster.

The work it's doing is parsing and binding all the mcdoc files (which contain the schemas for the generators). Unfortunately that process is not super quick right now (see https://github.com/SpyglassMC/Spyglass/issues/977). The plan in the future is to do most of the expensive operations once on a server or github action.