You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A number of functions in _pylong.py craft their own schemes to cache costly ** results. This complicates their code, and all of them end up doing more work than necessary.
So I want to add a new internal compute_powers() function that computes all and only the powers needed in advance, and returns a dict recording the results. It should speed things, but not by much (the time is dominated by how long it takes to compute the single largest power needed). The real point is code simplification.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
A new `compute_powers()` function computes all and only the powers of the base the various base-conversion functions need, as efficiently as reasonably possible (turns out that invoking `**`is needed at most once). This typically gives a few % speedup, but the primary point is to simplify the base-conversion functions, which no longer need their own, ad hoc, and less efficient power-caching schemes.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
SonicField
pushed a commit
to SonicField/cpython
that referenced
this issue
May 8, 2024
)
A new `compute_powers()` function computes all and only the powers of the base the various base-conversion functions need, as efficiently as reasonably possible (turns out that invoking `**`is needed at most once). This typically gives a few % speedup, but the primary point is to simplify the base-conversion functions, which no longer need their own, ad hoc, and less efficient power-caching schemes.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Proposal:
A number of functions in
_pylong.py
craft their own schemes to cache costly**
results. This complicates their code, and all of them end up doing more work than necessary.So I want to add a new internal
compute_powers()
function that computes all and only the powers needed in advance, and returns a dict recording the results. It should speed things, but not by much (the time is dominated by how long it takes to compute the single largest power needed). The real point is code simplification.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
_pylong.py
#118611The text was updated successfully, but these errors were encountered: