Item Transport Pipe - Performance issue
Sir-Will opened this issue ยท 5 comments
So if you disable this method. testInsert wont be called anymore, thats like half of your code. ;-)
As far as I see It is only checking if there is space to not oversaturate an input.
Even with all this code disabled your pipes are still working. they just oversaturate... which is no big deal because items will get send back. If you check every stack you are sending all the time (every tick?), on a big server this explains the why there is so much performace taken by like 1 pipe connection. We had it like up to 10% of server resources for 1 pipe connection. with 30 players playing.
Arent there any smarter way to do this? Like check if there is space once. -> Output. Save that on the pulling connecting. Remove that saved instance on arrival. -> send next items.
Right now the "testInsert()" method does a scan of all currently "flowing stacks" in the entire game instance (stored in a HashSet), something which probably isn't as efficient as it could be. I considered some kind of functionality where each network of transporters has its own list of flowing stacks, but this would have issues in the case where items are being transferred to the same inventory from multiple networks of transmitters. I think the best fix to this would be to split up the massive HashSet of flowing stacks into a HashMap, with the key being the coordinates of the destination and the value being the HashSet of stacks going to that location. It would require some effort to properly implement this change, but it should drastically reduce the amount of lag experienced. I'll see what I can do :)