Applied Energistics 2

Applied Energistics 2

156M Downloads

Add cache for interface recipes

Sir-Will opened this issue ยท 3 comments

commented

Describe the feature
It would be great if the recipes are being cached during the first init of interfaces, so that the crafting list doesn't need to be rebuild every time they get unloaded.

Reasons why it should be considered
The building of the crafting list often seems to be a heavy task which causes lag spikes when multiple interfaces are being loaded. Unfortunately does this repeat itself every time the chunk is unloaded and loaded again.
Having a cache for this would limit it to one time per interface and per session.

Additional Context

[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - sun.misc.Unsafe.getObjectVolatile(Native Method)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - java.util.concurrent.atomic.AtomicReferenceArray.getRaw(AtomicReferenceArray.java:130)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - java.util.concurrent.atomic.AtomicReferenceArray.get(AtomicReferenceArray.java:125)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - com.google.common.cache.LocalCache$Segment.getFirst(LocalCache.java:2818)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - com.google.common.cache.LocalCache$Segment.getEntry(LocalCache.java:2825)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2194)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - com.google.common.cache.LocalCache.get(LocalCache.java:4154)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.util.item.OreHelper.getOre(OreHelper.java:87)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.util.item.AEItemStack.<init>(AEItemStack.java:75)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.util.item.AEItemStack.fromItemStack(AEItemStack.java:86)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.core.api.ApiStorage$ItemStorageChannel.createStack(ApiStorage.java:150)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.core.api.ApiStorage$ItemStorageChannel.createStack(ApiStorage.java:134)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.helpers.PatternHelper.<init>(PatternHelper.java:107)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.items.misc.ItemEncodedPattern.getPatternForItem(ItemEncodedPattern.java:203)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.helpers.DualityInterface.addToCraftingList(DualityInterface.java:488)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.helpers.DualityInterface.updateCraftingList(DualityInterface.java:375)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.helpers.DualityInterface.initialize(DualityInterface.java:1234)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.tile.misc.TileInterface.onReady(TileInterface.java:166)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - appeng.hooks.TickHandler.onTick(TickHandler.java:220)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - net.minecraftforge.fml.common.eventhandler.ASMEventHandler_2091_TickHandler_onTick_TickEvent.invoke(.dynamic)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - net.minecraftforge.fml.common.eventhandler.EventBus.forgeBridge$post(EventBus.java:756)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:706)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - net.minecraftforge.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:266)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:712)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
[02:24:46] [Thread Locksmith Watchdog/INFO]: [threadlock]:  - java.lang.Thread.run(Thread.java:748)
commented

I don't see why it wouldn't be an issue in 1.15+ too, as the ore dictionary and recipes didn't get faster as far as I know.

commented

We no longer support any minecraft version older than 1.15 at this point.

Should you be able to confirm that this issue still applies to the most recent version, please update the issue and we will reopen it.

commented

As you obviously tested the 1.15+ behaviour, could you please provide a sampling or profiling dump so we can identify any bottleneck and try to resolve it?