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

De-duplicate fetching intermediate accounts #7411

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

ValarDragon
Copy link
Member

@ValarDragon ValarDragon commented Feb 5, 2024

State compatibly de-duplicate get intermediate account fetches. On its own, this isn't much of a savings (20ms with and w/o fast nodes -- not sure why theres cache hits in IAVL v1 and fast nodes off TBH). The hope is that this can be used with an additional filter to cheapen more expensive loops going on in both methods. The latter may not be state compatible, hence making two PR's.

This also removes getting the BondDenom from the core loop, saving another 60ms

@ValarDragon ValarDragon added V:state/compatible/backport State machine compatible PR, should be backported A:no-changelog A:backport/v22.x backport patches to v22.x branch labels Feb 5, 2024
@@ -799,7 +799,7 @@ func (k Keeper) Distribute(ctx sdk.Context, gauges []types.Gauge) (sdk.Coins, er

locksByDenomCache := make(map[string][]lockuptypes.PeriodLock)
totalDistributedCoins := sdk.NewCoins()
scratchSlice := make([]*lockuptypes.PeriodLock, 0, 10000)
scratchSlice := make([]*lockuptypes.PeriodLock, 0, 50000)
Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, accidental drive by change, but should be benign as the scratch slice's need should be max_{gauges}(# accts gauge pays out to)

Copy link
Contributor

@AlpinYukseloglu AlpinYukseloglu left a comment

Choose a reason for hiding this comment

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

LGTM

@ValarDragon ValarDragon merged commit fda7971 into main Feb 5, 2024
1 check passed
@ValarDragon ValarDragon deleted the dev/de_dedup_intermediate_acct_fetch branch February 5, 2024 19:18
mergify bot pushed a commit that referenced this pull request Feb 5, 2024
* De-duplicate fetching intermediate accounts

* Fix build

* De-duplicate BondDenom fetch

(cherry picked from commit fda7971)
ValarDragon added a commit that referenced this pull request Feb 5, 2024
* De-duplicate fetching intermediate accounts

* Fix build

* De-duplicate BondDenom fetch

(cherry picked from commit fda7971)

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v22.x backport patches to v22.x branch A:no-changelog C:x/incentives C:x/superfluid V:state/compatible/backport State machine compatible PR, should be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants