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

BigDec operation speedups (backport #8006) #8011

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 11, 2024

Changes:

  • Rename precisionReuse -> defaultBigDecPrecisionReuse
  • Rename precisionReuseSDK -> precisionReuseSDKDec
  • Use squaredPrecisionReuse properly (saving many internal ops). This is clearly state compat because we are replacing double Mul's with a single one that will commute.
  • expose precisionReuse as an argument more consistently
  • Remove redundant copies in many BigDec operations
  • Speedup common BigDec X Dec ops
    • Just needs tests
  • Speedup Quo w/ rounding - Update: My intuition was wrong for roundup, Now looking into RoundDown
    • Truncate was significantly sped up. (Saved the chop routine, and operate on something two word sizes smaller!)

Its easiest to review this PR commit by commit


This is an automatic backport of pull request #8006 done by Mergify.

* Rename precisionReuse and use squaredPrecisionReuse properly

* Remove redundant copies for chop operations

* Speedup RoundUpMut failed, just committing benchmark

* CL notes

* Speedup Truncate routines by saving ~2 word sizes

* Add BigDec x Dec fns

* Minor approx root spedup

* Driveby, better mut usage in stableswap

* Add AbsMut

* Auto: update go.mod after push to dev/bigdec_speedups that modified dependencies locally

---------

Co-authored-by: github-actions <[email protected]>
(cherry picked from commit b56059e)

# Conflicts:
#	go.mod
#	go.sum
#	osmomath/go.mod
#	osmomath/go.sum
#	osmoutils/go.mod
#	osmoutils/go.sum
#	x/epochs/go.mod
#	x/epochs/go.sum
#	x/ibc-hooks/go.mod
#	x/ibc-hooks/go.sum
Copy link
Contributor Author

mergify bot commented Apr 11, 2024

Cherry-pick of b56059e has failed:

On branch mergify/bp/v23.x-iavl-v1/pr-8006
Your branch is up to date with 'origin/v23.x-iavl-v1'.

You are currently cherry-picking commit b56059e4.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   CHANGELOG.md
	modified:   osmomath/decimal.go
	new file:   osmomath/decimal_bench_test.go
	modified:   osmomath/decimal_test.go
	modified:   x/concentrated-liquidity/math/math.go
	modified:   x/concentrated-liquidity/swapstrategy/one_for_zero.go
	modified:   x/gamm/pool-models/stableswap/amm.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   go.mod
	both modified:   go.sum
	both modified:   osmomath/go.mod
	both modified:   osmomath/go.sum
	both modified:   osmoutils/go.mod
	both modified:   osmoutils/go.sum
	both modified:   x/epochs/go.mod
	both modified:   x/epochs/go.sum
	both modified:   x/ibc-hooks/go.mod
	both modified:   x/ibc-hooks/go.sum

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@github-actions github-actions bot added C:x/gamm Changes, features and bugs related to the gamm module. C:x/epochs C:x/concentrated-liquidity labels Apr 11, 2024
@mergify mergify bot deleted the mergify/bp/v23.x-iavl-v1/pr-8006 branch April 11, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/concentrated-liquidity C:x/epochs C:x/gamm Changes, features and bugs related to the gamm module. conflicts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant