Item list is reloaded every time an inventory is opened with GT6
makamys opened this issue ยท 1 comments
With GT6, every time an inventory GUI (such as the player inventory or a chest) is opened, the item list is recomputed. This has a noticeable impact on performance. About 150 MB of garbage is allocated on the heap, and there is a ~10% increase in CPU usage on my machine (but at least it's on a separate thread).
With GT5u, the issue doesn't happen - the item list is only computed a single time.
Graphs
Code analysis
The issue happens because GT6 calls codechicken.nei.api.API#hideItem
to hide items inside the getSubItems
method of some of its items (PrefixItem
and PrefixItemBlock
). This causes the item list to get invalidated while it's in the process of being built, leaving it dirty forever. For example (printed by a debug print I added to the method):
markItemsDirty called. stack trace:
java.lang.Exception
at codechicken.nei.LayoutManager.markItemsDirty(LayoutManager.java:581)
at codechicken.nei.api.API.hideItem(API.java:134)
at gregapi.util.ST.hide(ST.java:956)
at gregapi.util.ST.hide(ST.java:946)
at gregapi.util.ST.hide(ST.java:942)
at gregapi.item.prefixitem.PrefixItem.func_150895_a(PrefixItem.java:128)
at codechicken.nei.ItemList$1.execute(ItemList.java:205)
at codechicken.nei.RestartableTask$1.run(RestartableTask.java:25)