MoreMcmeta / core

Animate almost any Minecraft texture with more options. Texture configuration API. 1.16-1.20
GNU Lesser General Public License v3.0
28 stars 5 forks source link

Excessive load times when Optifine and MoreMcmeta are installed #14

Closed nu11une closed 2 years ago

nu11une commented 2 years ago

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:

  1. Download and install MoreMcmeta and Optifine
  2. Try to launch the game

Which Minecraft versions does this bug affect?

Mod loader Which mod loaders does this bug affect?

Mods list What mods are you using? MoreMcmeta 1.19-3.0.4-forge Optifine HD U H8 Forge 41.0.63

soir20 commented 2 years ago

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.)

soir20 commented 2 years ago

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.

soir20 commented 2 years ago

I did some (crude) benchmarks with a phone stopwatch, and this is fixed locally:

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.

soir20 commented 2 years ago

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.)

soir20 commented 2 years ago

3.0.5 was released last night. Publication through continuous integration was successful! Please reopen this issue if the problem recurs, or open another issue if you notice bugs in the new version.

Fixed in commits: