AutoRegLib

AutoRegLib

130M Downloads

Lag due to EntityItemTickEvent

LemADEC opened this issue ยท 3 comments

commented

As of 1.3-20, CPU lag is observed in WorldTickEvent:

  • LagGoggle consistently report 0.5 to 0.6 ms per tick
    image

  • WarmRoast reports typically 0.5% usage
    image

From a quick code review, every tick, for every entity item, a new Event is created and fired, even when no mod is registered on said event:
https://github.com/Vazkii/AutoRegLib/blob/master/src/main/java/vazkii/arl/util/ItemTickHandler.java#L22

commented

How many entities were in the world at the time of this happening? You'd need a lot of entities for this to be relevant at all I reckon?

commented

Probably around 4k entities of all types at that time.

commented

Using VisualVM memory profiler, at least 35% of BlockPos allocations were referring to that custom event. There was ~1900 item entities loaded at the time.