Mekanism

Mekanism

111M Downloads

InductionPort optimization

bigenergy opened this issue ยท 1 comments

commented

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).

  1. mekanism.common.content.matrix.SynchronizedMatrixData # cells make final.
  2. Instead of HashSet we put Collections # newSetFromMap from the added Map <Coord4D, WeakReference >.
  3. In fact, newSetFromMap in its pure form will not work. You will need to make a copy with validation checks.
commented

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