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

Is perfect_power() too slow? #443

Open
mhostetter opened this issue Dec 8, 2022 · 2 comments
Open

Is perfect_power() too slow? #443

mhostetter opened this issue Dec 8, 2022 · 2 comments
Labels
performance Affects speed/performance

Comments

@mhostetter
Copy link
Owner

Some inputs to perfect_power() take a very long time to return. Is this expected? Is there an inefficiency in the algorithm?

In [2]: import galois

In [3]: %time galois.perfect_power(2**300)
CPU times: user 102 µs, sys: 129 µs, total: 231 µs
Wall time: 233 µs
Out[3]: (2, 300)

In [4]: %time galois.perfect_power(2**500)
CPU times: user 195 µs, sys: 247 µs, total: 442 µs
Wall time: 446 µs
Out[4]: (2, 500)

In [5]: %time galois.perfect_power(2**471)
CPU times: user 3.03 s, sys: 0 ns, total: 3.03 s
Wall time: 3.03 s
Out[5]: (2, 471)

In [6]: %time galois.perfect_power(2**571)
# Takes forever....
@mhostetter mhostetter added the performance Affects speed/performance label Dec 8, 2022
@mhostetter
Copy link
Owner Author

This is particularly slow for a prime to a prime power.

@mhostetter
Copy link
Owner Author

After #454, this runs as follows. There may still be an underlying bug in the perfect_power() algorithm, however.

In [1]: import galois

In [2]: %time galois.perfect_power(2**471)
CPU times: user 7 µs, sys: 14 µs, total: 21 µs
Wall time: 23.8 µs
Out[2]: (2, 471)

In [3]: %time galois.perfect_power(2**571)
CPU times: user 25 µs, sys: 0 ns, total: 25 µs
Wall time: 26.5 µs
Out[3]: (2, 571)

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

No branches or pull requests

1 participant