Idle soul cage has high processing time usage
TheRealWormbo opened this issue ยท 1 comments
Based on observations with the LagGoggles mod on 1.12.2, and supported by profiling with VisualVM, a soul cage seems use more processing time than I would expect while it doesn't really do anything (i.e. no soul shard inserted).
The cause seems to be calls to net.minecraft.world.World.func_175685_c (net.minecraft.util.math.BlockPos, net.minecraft.block.Block, boolean)
in TileEntitySoulCage's update()
method, which make up about 98% of the total run time of the update()
method. From a look at TileEntitySoulCage's source code, that appears to be the world.notifyNeighborsOfStateChange(...)
call in the "can't spawn" case. (I only tested with empty soul cages, but I'd assume the same call in the "can spawn" case is equally expensive.)
In the interest of server performance, it might be a good idea to limit those calls to when the state actually changes. As mentioned at the beginning, I tested this in 1.12.2, but based on the code in the 1.14 and 1.15 branches, the same issue likely also exists there.