perf: replace swap_path Vec<Address> with fixed-size SwapPath type#313
Open
Tomoya0k wants to merge 2 commits into
Open
perf: replace swap_path Vec<Address> with fixed-size SwapPath type#313Tomoya0k wants to merge 2 commits into
Tomoya0k wants to merge 2 commits into
Conversation
- Define SwapPath contract type and MAX_SWAP_PATH_LENGTH = 5 in libs/types - std::Vec was fastest (16,234 CPU) vs soroban_sdk::Vec (20,106 CPU) - Enforce path length at order creation time with revert if exceeded - Update order_handler, exchange_router, adl_handler, liquidation_handler, swap_utils, increase_position_utils, decrease_position_utils - All swap path tests pass including two_hop and boundary cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #300
Summary
std::vec::Vec<Address>(fastest at 16,234 CPU instructions vs 20,106 forsoroban_sdk::Vec)SwapPathcontract type withMAX_SWAP_PATH_LENGTH = 5inlibs/typesBenchmark results
Full write-up in
docs/swap_path_optimization.md.