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

Create BigDec mutative API's for ToDec and FromDec #7540

Closed
ValarDragon opened this issue Feb 19, 2024 · 1 comment · Fixed by #7577
Closed

Create BigDec mutative API's for ToDec and FromDec #7540

ValarDragon opened this issue Feb 19, 2024 · 1 comment · Fixed by #7577

Comments

@ValarDragon
Copy link
Member

Background

There are some real time overheads in Concentrated liquidity, involving converting Dec's to BigDec and BigDec's to Dec's. We do many more heap allocations than necessary.

These can almost always be made mutative. This can in principle offer a .5% sync speed speedup, but this will go down with the hopeful protorev restructuring.

To make this work well, we need to create BigIntMut() API's on LegacyDec upstream, similar to what is done for Int. See here: https://github.com/cosmos/cosmos-sdk/blob/main/math/int.go#L105-L111 . Once that exists, we can do this well.

Acceptance Criteria

Faster mutative BigDec.DecMut() and BigDec.FromDecMut() functions.

@ValarDragon
Copy link
Member Author

We should look through every usage of BigDec.Dec and NewBigDecFromDec in CL, I conjecture they are ~all available to be sped up like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant