Skip to content

Stocking optimization - #5169

Open
GilbertzRivi wants to merge 3 commits into
GregTechCEu:1.20.1from
GilbertzRivi:stocking-optimization
Open

Stocking optimization#5169
GilbertzRivi wants to merge 3 commits into
GregTechCEu:1.20.1from
GilbertzRivi:stocking-optimization

Conversation

@GilbertzRivi

Copy link
Copy Markdown
Contributor

What

Rework to stocking input buses and hatches

Implementation Details

This makes stocking buses and hatches managed by a grid service from AE2, so instead of each bus polling for all its items each 40 ticks, AE2 keeps track of all stocking parts in the grid and updates them accordingly. AE2 keeps a cached inventory updated each tick anyway, so based on that cache if any item that is observed by any bus (or fluid by hatch) changed in quantity, AE2 remembers and when the bus's tick is due, it checks the real extractable amount from the network (at most once per key per tick) and then updates all parts tracking that key. It also updates them silently and after its done then notifies their listeners, so 5 changes in the same bus will notify its RHL only once. Autopull is now also managed from the grid service, it does check for the top X keys in the network cache, then tries to fill the bus with those keys checking extractable amounts while doing so for valid candidates. It does also checks if a key is valid for the bus, if it does not exist in any other bus in the same group (painting or just not distinct).

AI Usage

  • Yes AI driven tools were used for this pull request.

Agent Used

ClaudeCode Opus 4.8
Usage Description
I used it for basic sanity checking my work if i didn't miss anything important, and to help me get a wider view of the repo and the thing i wanted to do. I also used it to make a tool to measure the performance but it was not commited to the repo as it was only a tool.

Outcome

It improves performance a lot on a bases that rely heavily on stocking buses/hatches

How Was This Tested

My friend tested this both with #5165 on 7.5.3 then I moved all stocking bus/hatch changes to this branch and on weaker CPU in endgame monifactory base the results were good, stocking parts no longer were top1 in observable and stopped taking 26% instead they took 0,8%.
image
before:
image
after:
image

Additional Information

it wont work without #5168 because it fixes me hatches/buses UI so it works at all. Didn't want to make it in 1 PR in case you don't want this one.

Additional information 2

My friend profiled #5165 change and a this one with spark and the results are bellow (screenshots + links because links expire):
image
image
OLD: https://spark.lucko.me/MjRH6gc91y
NEW: https://spark.lucko.me/JmBrjCa5tZ
I also profiled this a bit earlier when not all the current changes were implemented and I did it on a weaker laptop, results bellow:
image
image
OLD: https://spark.lucko.me/MfsQrUmAzH
NEW: https://spark.lucko.me/XWbaUwQIkc

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant