Reduce future size#285
Merged
Merged
Conversation
execute_transaction_and_wait_for_checkpoint stack-pinned the checkpoint scan and the execute-then-GetTransaction future with `tokio::pin!`, which inlines both tonic call chains into the method's own state machine. Because the two are alive simultaneously, their sizes add instead of sharing space the way sequential awaits do, growing the returned future from 8.0 KiB before the concurrent-scan change to 10.7 KiB -- large enough to threaten a stack overflow for callers that hold it in deeply nested or spawned futures. With this commit, both sub-futures are boxed so their state lives on the heap: the method's future now carries two pointers plus its small locals and measures 3.4 KiB, below even the pre-concurrent-scan baseline.
get_validator_address_by_pool_id awaited the SimulateTransaction call inline, and that call chain (about 4.9 KiB of tonic state) dominated the helper's future. Because the helper is itself inlined through try_create_delegated_stake_info, the size propagated into get_delegated_stake (5.5 KiB) and list_delegated_stake (5.3 KiB). With this commit, the simulate await is boxed so the call chain lives on the heap. The three futures now measure 248 bytes, 1.7 KiB, and 1.9 KiB respectively; the remainder is the baseline cost of a single inline unary call.
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.
No description provided.