CIT Resewn

CIT Resewn

14M Downloads

Poor performance when rendering many custom elements/textures

Vricken opened this issue ยท 2 comments

commented

I am not a mod developer, nor a Java developer so sorry if what I am saying is stupid, obvious, or makes no sense.

Context: I am creating a modpack with a large texture pack and when I look at a lot of players with custom items my games lags a lot, from like 90fps down to 10. I installed the spark mod to find out what was causing the lag and this is what I found.

Issue:
Using spark I have found that the CIT.test() function is responsible.
image
image

Possible solutions:
As I said at the start I'm not familiar with modding so what I'm about to say may not apply but my past coding experience gives me some ideas.

If the function is slow: idk how it works so idk how to help maybe you could try a different method to accomplish the same result. I have seen that threads #311 and #320 offer possible solutions to this issue.

If the function is being called a lot of times (which is what I imagine is happening): Use memorization (or/and maybe even tabulation) to store the result of the function given the input so that the function has to be evaluated many fewer times.

commented

There is already a way of memoizing and it is the CIT Cache, if your pc is struggling with large resourcepacks you can go to the config and raise the cache time to longer than default.
#311 and #320 are being examined currently as I decide how to go about implementing those changes.

commented

I have learned the basics of java and with the help of chat gpt I have written a patch which implements the memoization idea to massively increase performance when loading lots of custom models such as seeing many players or using mods such as REI with big texture packs such as Hypixel+. It is late for me so I will upload my work tomorrow when I wake up.