InductionPort optimization
bigenergy opened this issue ยท 1 comments
I have profiled my server, and found about 10% of the mekanism load.
https://sparkprofiler.github.io/#bEtG24Js7n
You can speed up Mekanism a little if you put the tile cache next to mekanism.common.content.matrix.SynchronizedMatrixData#cells (validation is performed while looking at the implementation of net.minecraft.tileentity.TileEntity#invalidate).
- mekanism.common.content.matrix.SynchronizedMatrixData # cells make final.
- Instead of HashSet we put Collections # newSetFromMap from the added Map <Coord4D, WeakReference >.
- In fact, newSetFromMap in its pure form will not work. You will need to make a copy with validation checks.
You profiling data isn't very useful as it doesn't show how many times said method was called, nor does it show the method's self-time.
While perhaps get/setEnergy could be optimised, I don't agree with your proposed solution of using a weak referenced map to cache the TileEntities - they would still need to be checked with isInvalid()
and then re-queried if invalid. Your explanation is super confusing too btw.
You're welcome to implement the code and if you can prove that it causes less time send a PR though