
Excessive load times when Optifine and MoreMcmeta are installed
nu11une opened this issue ยท 5 comments
Describe the bug
Trying to launch the game with Optifine and MoreMcmeta installed will result in the game getting stuck on the mojang loading screen.
To reproduce
Steps to reproduce the behavior:
- Download and install MoreMcmeta and Optifine
- Try to launch the game
Which Minecraft versions does this bug affect?
- 1.16
- 1.17
- 1.19
Mod loader
Which mod loaders does this bug affect?
- Forge
- Fabric
Mods list
What mods are you using?
MoreMcmeta 1.19-3.0.4-forge
Optifine HD U H8
Forge 41.0.63
I'm able to reproduce this behavior locally.
OptiFine doesn't seem to work in a dev environment like other mods do, and it's also closed-source, so my ability to debug this is much more limited. I'll see what I can do. (I have a hunch at what the problem is based on the logs; we'll see what I can figure out from there.)
The game actually finished loading just after my last message. It does seem to take absurdly long, so I will try to look into why. But if absolutely necessary in the meantime, you should be able to play with MoreMcmeta and OptiFine together if you wait out the loading screen.
I did some (crude) benchmarks with a phone stopwatch, and this is fixed locally:
- OptiFine + MoreMcmeta 3.0.4: 8 min. 25 sec.
- OptiFine + MoreMcmeta dev: 1 min. 31 sec.
- OptiFine by itself: 1 min. 22 sec.
- MoreMcmeta dev by itself: 1 min. 6 sec.
- Forge 41.0.63 without mods: 1 min. 4 sec.
These times are from when I press the "start" button in the Minecraft launcher to when resource loading on startup finishes.
From the logs, it appears that OptiFine requests all the current resource packs multiple times during resource loading. However, MoreMcmeta scans all resources each time the resource packs are requested as a workaround to avoid concurrency bugs. Normally, the packs are only requested once, so there is little to no performance impact. I'm not sure why exactly OptiFine does this; I assume it's doing some kind of parallelized resource scanning. I implemented a cache for the results of MoreMcmeta's resource scan, and this significantly improved performance with OptiFine.
As I am not sure if OptiFine is causing MoreMcmeta to do the resource scans concurrently, I have implemented the cache under the assumption that the scans are concurrent. Concurrency is delicate, so I need to do some more testing/review of the cache implementation to make sure I haven't introduced new bugs.
My plan is to publish the fixed version this weekend unless something comes up.
(As a side note, 3.0.5 will be the first version auto-published through continuous integration.)