-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
math/big: replace the division with multiplicative inverse #41023
Comments
Change https://golang.org/cl/250417 mentions this issue: |
This issue doesn't need to be a proposal. It's just an optimization - go for it. |
Yes there is. I added the API because I am not sure if I should completely replace the original division method. If we want to think of it as an optimization, we can use a more sophisticated method without adding an API. I will make the corresponding changes in my CL. |
@randall77 Im sry that I don't know how to remove the proposal tag. I replaced the original division function, deleted the modification to the bits package and changed getInvert to internal interface so that there's no new API in bits package. |
Note that this is also the same as issue #9246 math/big: avoid DIVQ I'm not sure if the two issues should be merged or one closed. |
I believe they are the same issue. |
@randall77 Yes, I think so. Should I close this issue? |
No, probably easier just put a "Fixes #9246" line in your CL description (so both will be closed when this CL lands). |
CL looks done and Trybots are happy. Merge? |
It's already merged, it just didn't have the |
Division is much slower than multiplication, as we know. The algorithm for dividing 128 digits by 64 digits in math/bits.go/Div64, which has a certain impact on the efficiency of nats division, requires two divisions. And the method of using multiplication by 2/1 (128bits divide 64bits )multiplicative inverse and replacing division with it can increase the speed of divWVW algorithm by three times, and at the same time increase the speed of nats division.
I have submitted a code change using 2/1 type multiplicative inverse and the corresponding benchmark data in gerrit. If possible, using a 3/2(192bits divide 128bits) type multiplicative inverse and changing the structure of nats division code will get a more obvious improvement.
The text was updated successfully, but these errors were encountered: