Mob proof crystals [Fabric]

Mob proof crystals [Fabric]

21.1k Downloads

CanSpawn function overhead causes 30% MSPT increase

MeeniMc opened this issue · 1 comments

commented

The way this addon is implemented is costly for the 'canSpawn' method.

I ran a typical mobfarm with and without this addon with Spark (a profiler), the canSpawn method uses 37% of the tick cost with this addon, versus 4% without.

Overall, using carpet's tick warp runs at 50 TPS versus 80 TPS without the addon.

I suspect this is mostly due to the search for the crystal in the box around the potential spawn mob. Having some sort of list containing the crystals' position could help.

commented

I'm guessing your idea is to have a written list in a file that updates every time a crystal is placed or removed.

It is a possible solution, at cost of having to update the list every time a crystal is renamed, created, or destroyed, which due to their explosive behaviour could lead to considerable lag spikes (maybe) when having a chain destruction.

If instead of having a static file i have an object in memory, it would need to search for every crystal placed before it was created (when the world is closed, the object is reomved) causing a bit more delay in the start of the world (considerable more for bigger worlds).

Maybe a combination of both could lead to a better aporach: Having an object when the world is running, based in the file previously created when the world closes (This could lead to potential unhandled crystals if crashes or unexpected closes occurs)¨.

All of these are just my guessings, as I have not done a really deep research yet.