CC: Tweaked

CC: Tweaked

57M Downloads

TurtlePlaceCommand causing latency issues with FakePlayer creation

bloodmc opened this issue ยท 4 comments

commented

TurtlePlaceCommand seems to be generating new FakePlayer's every time it is run. This is causing latency issues as shown below. This should be cached because it's not a good idea to generate new players every time this updates.

https://github.com/SquidDev-CC/CC-Tweaked/blob/master/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java#L71

net.minecraft.world.WorldServer.updateTileEntity()40.38%
org.spongepowered.common.event.tracking.TrackingUtil.tickTileEntity()40.26%
dan200.computercraft.shared.turtle.blocks.TileTurtle.update()14.16%
dan200.computercraft.shared.turtle.core.TurtleBrain.update()12.72%
dan200.computercraft.shared.turtle.core.TurtleBrain.updateCommands()12.25%
dan200.computercraft.shared.turtle.core.TurtleSuckCommand.execute()10.52%
dan200.computercraft.shared.turtle.core.TurtlePlaceCommand.createPlayer()10.29%
dan200.computercraft.shared.turtle.core.TurtlePlayer.<init>()10.29%
net.minecraftforge.common.util.FakePlayer.<init>()10.29%
net.minecraft.entity.player.EntityPlayerMP.<init>()10.29%
net.minecraft.server.management.PlayerList.func_192054_h()9.92%
net.minecraft.advancements.PlayerAdvancements.<init>()9.92%
net.minecraft.advancements.PlayerAdvancements.func_192740_f()9.92%
net.minecraft.advancements.PlayerAdvancements.func_192752_d()8.92%
net.minecraft.advancements.PlayerAdvancements.func_192742_b()8.76%
commented

I see you do cache here

https://github.com/SquidDev-CC/CC-Tweaked/blob/master/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java#L84

So this may not be an issue after all =)
I'm going to see why FakePlayer's are initializing advancements as well.

commented

I think this was fixed recently :)

commented
commented

Yes, I'm using an older build so that explains why I am seeing the trace above.
Glad to see it's fixed =)
Thanks