Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better input ordering #2175

Merged
merged 15 commits into from
Mar 20, 2024
Merged

Better input ordering #2175

merged 15 commits into from
Mar 20, 2024

Conversation

DaughterOfMars
Copy link

@DaughterOfMars DaughterOfMars commented Mar 12, 2024

Description of change

Previously, we sorted the inputs when the builder is finished (and in the mana requirement) but this was unnecessary as we can sort them when selecting instead and just maintain the sorted order.

UPDATE: After some re-evaluation, the above approach is not possible because inputs may be added that have requirements that have not yet been selected, but will be later. This would then need basically the same re-sorting logic. Instead, I implemented a custom collection which holds useful information for ordering the inputs and handles the actual order in the iterator implementations. This does require some additional memory overhead per reference iterator call (but not for consuming iteration): An additional VecDeque and BTreeMap are allocated, plus one VecDeque per non-ed25519 address.

Copy link
Member

@Thoralf-M Thoralf-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing test

@DaughterOfMars DaughterOfMars self-assigned this Mar 13, 2024
Thoralf-M
Thoralf-M previously approved these changes Mar 14, 2024
@DaughterOfMars DaughterOfMars changed the title Order inputs on selection instead of sorting later Better input ordering Mar 15, 2024
@DaughterOfMars DaughterOfMars merged commit 5669e9b into 2.0 Mar 20, 2024
37 checks passed
@DaughterOfMars DaughterOfMars deleted the feat/input-order branch March 20, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants