henkelmax / pipez

Lag friendly pipes.
49 stars 25 forks source link

"As Seen" distribution mode #126

Open Rseding91 opened 2 years ago

Rseding91 commented 2 years ago

Is your feature request related to a problem? Please describe. I'm always trying to squeeze more performance out of modded Minecraft and I love Pipez for what it can do. However I don't need the order of items inserted to be nearest-first, furthest-first or in any specific order: I just want it to shove items into the connected inventories as fast as It can until it runs out of places to put things or items to shove.

Describe the solution you'd like I'd like a "As Seen" or "As Connected" distribution mode that visits the connected inventories in what ever order the Pipez internal logic has them stored (no sorting required).

Describe alternatives you've considered N/A

Additional context I downloaded Pipez locally and made this change with minimal effort. For the maintainers I think this would take 10~ minutes to implement if even that. For reference this is the icon I went with: image

henkelmax commented 1 year ago

This would have no performance impact, as connections are always cached.

Rseding91 commented 1 year ago

The connections are cached; but the order they're provided to the insertion logic is not: https://github.com/henkelmax/pipez/blob/master/src/main/java/de/maxhenkel/pipez/blocks/tileentity/UpgradeTileEntity.java#L144 creates a new collection and sorts them every time the method is called.

Rseding91 commented 1 year ago

@henkelmax Can this be re-opened per my comment above? The code shows that the 'as seen' would avoid the extra collection and sort call which is not cached.