Pollen

Pollen

4M Downloads

[1.18.2] Performance Drain gg.moonflower.pollen.api.registry.EventRegistry.invokeFast()0.08%

Reshy opened this issue ยท 1 comments

commented

What version are you seeing the problem on?

1.18.2

Describe the issue

Pollen seems to be adding some unnecessary overhead to each mobs just by virtue of being installed, something regarding "reflection" and "unreflection":

net.minecraft.world.entity.Mob.tick()51.33%

net.minecraft.world.entity.LivingEntity.tick()51.23%
    net.minecraft.world.entity.Entity.tick()5.31%
        net.minecraft.world.entity.Mob.baseTick()4.04%
            net.minecraft.world.entity.LivingEntity.baseTick()3.90%
                net.minecraft.world.entity.LivingEntity.handler$edm000$tickFluidDrowning()0.32%
                    gg.moonflower.pollen.api.registry.FluidBehaviorRegistry.get()0.01%
                        java.util.Collection.stream()0.01%
                            java.util.stream.StreamSupport.stream()0.01%8ms
        net.pyromancer.entity.PyronadoEntity.baseTick()0.95%
    net.minecraft.world.entity.LivingEntity.handler$edm006$tick()3.70%

net.minecraft.world.entity.npc.Villager.tick()4.38%

net.minecraft.world.entity.Mob.tick()4.37%
    net.minecraft.world.entity.LivingEntity.tick()4.37%
        net.minecraft.world.entity.LivingEntity.handler$edm006$tick()0.17%
            jdk.proxy3.$Proxy69.tick()0.17%
                gg.moonflower.pollen.api.registry.EventRegistry$$Lambda$4375/0x0000000800db2a78.invoke()0.17%
                    gg.moonflower.pollen.api.registry.EventRegistry.lambda$createLoop$0()0.17%
                        gg.moonflower.pollen.api.registry.EventRegistry.invokeFast()0.17%
                            java.lang.invoke.MethodHandles$Lookup.unreflect()0.10%
                            java.lang.invoke.MethodHandle.invokeWithArguments()0.07%

net.minecraft.world.entity.monster.Skeleton.tick()0.81%

net.minecraft.world.entity.Mob.tick()0.81%
    net.minecraft.world.entity.LivingEntity.tick()0.81%
        net.minecraft.world.entity.LivingEntity.handler$edm006$tick()0.08%
            jdk.proxy3.$Proxy69.tick()0.08%
                gg.moonflower.pollen.api.registry.EventRegistry$$Lambda$4375/0x0000000800db2a78.invoke()0.08%
                    gg.moonflower.pollen.api.registry.EventRegistry.lambda$createLoop$0()0.08%
                        gg.moonflower.pollen.api.registry.EventRegistry.invokeFast()0.08%
                            java.lang.invoke.MethodHandles$Lookup.unreflect()0.05%
                                java.lang.invoke.MemberName.<init>()0.02%
                                java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager()0.02%
                            java.lang.invoke.MethodHandle.invokeWithArguments()0.03%

net.minecraft.world.entity.monster.Zombie.tick()0.75%

net.minecraft.world.entity.Mob.tick()0.74%
    net.minecraft.world.entity.LivingEntity.tick()0.74%
        net.minecraft.world.entity.LivingEntity.handler$edm006$tick()0.03%
            jdk.proxy3.$Proxy69.tick()0.03%
                gg.moonflower.pollen.api.registry.EventRegistry$$Lambda$4375/0x0000000800db2a78.invoke()0.03%
                    gg.moonflower.pollen.api.registry.EventRegistry.lambda$createLoop$0()0.03%
                        gg.moonflower.pollen.api.registry.EventRegistry.invokeFast()0.03%
                            java.lang.invoke.MethodHandles$Lookup.unreflect()0.02%
                            java.lang.invoke.MethodHandle.invokeWithArguments()0.01%
                            java.lang.invoke.MethodHandle.bindTo()0.01%

net.minecraft.world.entity.animal.AbstractSchoolingFish.tick()0.52%

net.minecraft.world.entity.Mob.tick()0.52%
    net.minecraft.world.entity.LivingEntity.tick()0.52%
        net.minecraft.world.entity.LivingEntity.handler$edm006$tick()0.05%
            jdk.proxy3.$Proxy69.tick()0.05%
                gg.moonflower.pollen.api.registry.EventRegistry$$Lambda$4375/0x0000000800db2a78.invoke()0.05%
                    gg.moonflower.pollen.api.registry.EventRegistry.lambda$createLoop$0()0.05%
                        gg.moonflower.pollen.api.registry.EventRegistry.invokeFast()0.05%
                            java.lang.invoke.MethodHandle.invokeWithArguments()0.03%
                            java.lang.invoke.MethodHandles$Lookup.unreflect()0.01%

net.minecraft.world.entity.ambient.Bat.tick()0.52%

net.minecraft.world.entity.Mob.tick()0.52%
    net.minecraft.world.entity.LivingEntity.tick()0.52%
        net.minecraft.world.entity.Entity.tick()0.09%
            net.minecraft.world.entity.Mob.baseTick()0.09%
                net.minecraft.world.entity.LivingEntity.baseTick()0.09%
                    net.minecraft.world.entity.LivingEntity.handler$edm000$tickFluidDrowning()0.01%
        net.minecraft.world.entity.LivingEntity.handler$edm006$tick()0.05%
            jdk.proxy3.$Proxy69.tick()0.05%
                gg.moonflower.pollen.api.registry.EventRegistry$$Lambda$4375/0x0000000800db2a78.invoke()0.05%
                    gg.moonflower.pollen.api.registry.EventRegistry.lambda$createLoop$0()0.05%
                        gg.moonflower.pollen.api.registry.EventRegistry.invokeFast()0.05%
                            java.lang.invoke.MethodHandle.invokeWithArguments()0.03%
                            java.lang.invoke.MethodHandles$Lookup.unreflect()0.01%

latest.log

Spark:  https://spark.lucko.me/HGgGsOrQw9
commented

<0.5% of the tick is not enough of a performance impact to be a cause of concern. In 1.18 pollen the event and fluid apis use static calls to keep the performance footprint low. They are based on Architectury API events so they still perform much better than default Forge events.