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

Multiply by power of 5 and then shift left #73

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

xtonik
Copy link

@xtonik xtonik commented Jun 16, 2023

It is up to 10% more performant to multiply by power of 5 and then shift left than multiplying directly by power of 10 for some bit ranges when used standard BigInteger.multiply().

Minimal number of bits, for which is variant more performant was determined to 800 using benchmark.

The use of powers of five is limited from above by constant FftMultiplier.FFT_THRESHOLD.

There is several times more places to be changed than provided example in 1041b4b.

There is some performance trade off in proposed example, as powers of five are computed separately of powers of ten so some powers of ten are stored uselessly since. More aggressive changes to the code are necessary then.

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

Successfully merging this pull request may close these issues.

2 participants