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

Speedup core loop of epoch #7174

Merged
merged 2 commits into from
Dec 21, 2023
Merged

Speedup core loop of epoch #7174

merged 2 commits into from
Dec 21, 2023

Conversation

ValarDragon
Copy link
Member

Speeds up the core loop of the epoch.

  • Removes coins.Sort() which actually creates a copy of the slice due to complex runtime reasons.
  • Removes AmountOfNoDenomValidation runtime eq checks
  • Removes allocations in the Quo operation

This is an expected 7 second CPU time speedup on the Epoch code.

@ValarDragon ValarDragon added V:state/compatible/backport State machine compatible PR, should be backported A:no-changelog A:backport/v21.x backport patches to v21.x branch labels Dec 21, 2023
@@ -654,22 +654,28 @@ func (k Keeper) distributeInternal(
}
// total_denom_lock_amount * remain_epochs
lockSumTimesRemainingEpochs := lockSum.MulRaw(int64(remainEpochs))
lockSumTimesRemainingEpochsBi := lockSumTimesRemainingEpochs.BigIntMut()
Copy link
Member

Choose a reason for hiding this comment

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

nit: consider expanding Bi to BigInt for readability

x/incentives/keeper/distribute.go Outdated Show resolved Hide resolved
Co-authored-by: Roman <roman@osmosis.team>
@ValarDragon ValarDragon merged commit ec36033 into main Dec 21, 2023
1 check passed
@ValarDragon ValarDragon deleted the dev/epoch_core_loop_spedeup branch December 21, 2023 19:51
mergify bot pushed a commit that referenced this pull request Dec 21, 2023
* Speedup core loop of epoch

* Update x/incentives/keeper/distribute.go

Co-authored-by: Roman <roman@osmosis.team>

---------

Co-authored-by: Roman <roman@osmosis.team>
(cherry picked from commit ec36033)
ValarDragon added a commit that referenced this pull request Dec 21, 2023
* Speedup core loop of epoch

* Update x/incentives/keeper/distribute.go

Co-authored-by: Roman <roman@osmosis.team>

---------

Co-authored-by: Roman <roman@osmosis.team>
(cherry picked from commit ec36033)

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

Successfully merging this pull request may close these issues.

None yet

2 participants