Skip to content

Don't attempt to insert items to full inventories to save on performance#1251

Open
Swedz wants to merge 2 commits intoAztechMC:1.21.xfrom
Swedz:dont-insert-to-full
Open

Don't attempt to insert items to full inventories to save on performance#1251
Swedz wants to merge 2 commits intoAztechMC:1.21.xfrom
Swedz:dont-insert-to-full

Conversation

@Swedz
Copy link
Copy Markdown
Collaborator

@Swedz Swedz commented Mar 12, 2026

Machines that auto extract to full inventories (such as a barrel) can take a high amount of µs/t. This can be reproduced by simply placing an electric furnace with auto eject into an iron barrel. The barrel should be filled with the output of the recipe running in the furnace, and the furnace should be run until the output is full. This results in the machine, every tick, trying to push the output into the barrel and failing. I recommend using Observable to see this per-block entity.

This PR prevents unnecessary insert attempts when the target inventory is full. This is implemented for SlotItemHandler and MIItemStorage$ItemHandler - which should cover all MI machines, hatches, and barrels. So it is worth noting that this improvement only applies to ItemHandlers that implement FilledItemStorage.

Profile reports courtesy of PupleDino on discord:

Spark Report (Before)
image

Spark Report (After)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant