-
Notifications
You must be signed in to change notification settings - Fork 607
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 more stable swap math operations #7214
Conversation
Important Notice This PR modifies an in-repo Go module. It is one of:
The dependent Go modules, especially the root one, will have to be Please follow the instructions below:
Please let us know if you need any help. |
It seems the failed test is related to the change, will wait to review until passing, unless you want me to look into it @ValarDragon |
Fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 🌮
@@ -63,15 +63,16 @@ func targetKCalculator(x0, y0, w, yf osmomath.BigDec) osmomath.BigDec { | |||
// $$k_{iter}(x_f) = -x_{out}^3 + 3 x_0 x_{out}^2 - (y_f^2 + w + 3x_0^2)x_{out}$$ | |||
// where x_out = x_0 - x_f | |||
func iterKCalculator(x0, w, yf osmomath.BigDec) func(osmomath.BigDec) osmomath.BigDec { | |||
// compute coefficients first | |||
cubicCoeff := osmomath.OneBigDec().Neg() | |||
// compute coefficients first. Notice that the leading coefficient is -1, we will use this to compute faster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to other reviewers: x_{out}^3 remains same
Co-authored-by: Matt, Park <[email protected]>
* Speedup more stable swap math operations * Try another speedup * revert one sigfig change * remove one more mutative operation * update osmomath * Update osmomath one more tiome * Update osmomath/decimal.go Co-authored-by: Matt, Park <[email protected]> --------- Co-authored-by: Matt, Park <[email protected]> (cherry picked from commit 9cd7231) # Conflicts: # go.mod # go.sum # osmomath/decimal.go # osmomath/decimal_test.go
* Speedup more stable swap math operations (#7214) * Speedup more stable swap math operations * Try another speedup * revert one sigfig change * remove one more mutative operation * update osmomath * Update osmomath one more tiome * Update osmomath/decimal.go Co-authored-by: Matt, Park <[email protected]> --------- Co-authored-by: Matt, Park <[email protected]> (cherry picked from commit 9cd7231) # Conflicts: # go.mod # go.sum # osmomath/decimal.go # osmomath/decimal_test.go * fix conflicts (still need to run action) * fix go mods to run script * go mod updates v21 instead of main --------- Co-authored-by: Dev Ojha <[email protected]> Co-authored-by: Adam Tucker <[email protected]> Co-authored-by: Adam Tucker <[email protected]> Co-authored-by: mattverse <[email protected]>
Speedup more stableswap math operations. Anticipated 2% speedup to CPU time of syncing