Resourceful Bees

Resourceful Bees

10M Downloads

[Bug]: Lag from saving TieredBeehives

Darkere opened this issue · 4 comments

commented

Bug Description

Saving apiaries takes a long time if there are a lot of combs inside.

On this line numberOfCombs() seems to copy the list of all combs every iteration.

https://github.com/Resourceful-Bees/ResourcefulBees/blob/d0185b195851d86f33ccdaec3294319b24094bc4/src/main/java/com/resourcefulbees/resourcefulbees/tileentity/TieredBeehiveTileEntity.java#L248

Spark report that shows the issue in practice:

https://spark.lucko.me/gSGXLzjdGS

Screenshot in case the report expires:
image

How to Reproduce?

No response

Expected Behavior

No response

Version

github latest

Mod Loader Version

any

Logs or additional context

No response

Acknowledgement

  • I agree that I read the terms at the top of the page.
commented

Thank you for the report! I’ll take a look at it as soon as I am able to. A bit busy this week as I just brought my baby home from the hospital on Sunday.

commented

We can probs replace our current honeycomb storage system with a itemstackhandler, would also probs fix this issue and allow for less redundant code as we are essentially just making our own itemstack handler but using a queue system.

commented

I mean yes that will help, but for a quick fix just putting numberOfCombs() into a variable will already reduce the impact significantly. Evaluating that every iteration is just completely pointless.

commented

ill port that back to the legacy branch later