The Spectator item lag
someaddons opened this issue ยท 9 comments
Version Information
Forge version: ATM 6 1.16.3
Botania version: ATM 6 1.16.3
One single player having the spectator equipped causes about 7% ticklag on the whole server, removing the item and the lag is gone.
Further Information
https://spark.lucko.me/#XzPjWDYegS With the item
https://spark.lucko.me/#KFnXj4pi8L Without the item
What I expected to happen:
I think a single item on a player should not constantly generate so much cpu usage, esp when playing with multiple players on a server
I can see a small increase in the TPS graph while holding an item versus not holding an item, and an even larger increase when holding items in both hands. The increase seems to depends on the number of inventories to search, which is not surprising. However, the additional increase when holding two items can probably be prevented. Also it might make sense to cache results and not update them every tick, unless something changes.
I don't see where you're pointing to. What part of the profile is concerning you (give a path of methods to click into)?
Nvm, I see it.
Unfortunately, that's just how the item works, it scans the surroundings for item entities, scans all container contents, and scans all entity inventories, which comes out to a lot of work. I'll look into it but I don't foresee there being much I can do besides throttling the update rate.
no, because not all entity or container inventories are sent to the client, so at least that part needs to be server side. item entities could be moved, though.
ye I think throttling the rate should be enough, can imagine that scanning so much is costly. Since its each tick atm doing it once a second would be 20times less on avg, that should help a bunch
hm looking at the code, the item is just for visualizing stuff around you right? maybe just client side is enough for it?
hm entities and containers should be synced over though, else you cannot see/access them on the client