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

Convert to base 10 is significantly slower than similar libraries #315

Open
HKalbasi opened this issue Dec 13, 2024 · 2 comments
Open

Convert to base 10 is significantly slower than similar libraries #315

HKalbasi opened this issue Dec 13, 2024 · 2 comments

Comments

@HKalbasi
Copy link

Other libraries like GMP use a divide and conquer algorithm which find a power of 10 with size near half of the digits of the number, use that as the base and convert the original number to a 2 digit number in that base, convert each digit recursively to base 10 and finally concat the results. Assuming that we have a O(nlogn) multiplication routine, this algorithm would be O(nlog^2 n) and would be faster than the current O(n sqrt n) algorithm.

@cuviper
Copy link
Member

cuviper commented Dec 13, 2024

The current algorithm came in #216, and I mentioned then:

I honestly expect there's still room for improvement,

Help is welcome!

@HKalbasi
Copy link
Author

I'm interested in helping, num-bigint is the default choice for arbitrary precision integers in Rust so I think it is important to make it fast.

The first step is to merge #282 or something like that since the above algorithm requires a fast multiplication algorithm.

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

No branches or pull requests

2 participants