Hidoni / Transmog

A Minecraft mod to solve the long-standing issue of not looking cool enough.
MIT License
4 stars 0 forks source link

[1.21.1-Neo] Mod causing fps drops when being in inventory while JEI is active. #16

Open Gbergz opened 2 months ago

Gbergz commented 2 months ago

When inventory is open with JEI on the side the FPS goes from my normal ~450 fps down to 70 fps.

I ran a spark client profiler and it seems to be a combo between Transmog & Applied Energistics 2 Wireless Terminals ? Removing both mods restores the FPS to the normal FPS I'd expect.

ss

ss2

I have reported this to Applied Energistics 2 Wireless Terminals aswell which noted is also Transmog making it worse. So thought I'd report it here aswell.

Profiler Link: https://spark.lucko.me/DkJi8Z3XuS

Versions MC: 1.21.1 AE2: 19.0.22-beta AE2 WT: 19.1.3 Transmog: v1.5.0 JEI: 19.18.0.199 NeoForge: 21.1.50

Reported to AE2WTLib here: https://github.com/Mari023/AE2WirelessTerminalLibrary/issues/305

Mari023 commented 1 month ago

this specific performance issue is now fully fixed in ae2wtlib, tho it seems plausible that a similar problem could happen with other mods in the future.

the problem was ae2wtlib calling Player#getInventory() very often (like looping over all slots multiple times per frame often), which normally wouldn't be a problem, but since it was during rendering (specifically drawing the count of some itemstacks in the hotbar), it was hitting the slower path in your code here: https://github.com/Hidoni/Transmog/blob/2cca43060e1c9cf917131eac0dc5a518bc419844/Common/src/main/java/com/hidoni/transmog/mixin/PlayerMixin.java#L40-L53 since Player#getInventory() is usually just a getter, it seems reasonable to call it rather frequently

Is it be possible to target this mixin more precisely, so it is less likely that the slower path is hit accidentally? If I understand this code correctly, it might also cause issues with mods that check the inventory for specific items in that timeframe.

Tho it would also be reasonable to not do anything about this for now given that there are currently no known cases of mods accidentally triggering this anymore.