-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Speedup math.log by removing AC stuff #102839
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
Labels
Comments
skirpichev
added a commit
to skirpichev/cpython
that referenced
this issue
Mar 21, 2023
Before: $ ./python -m timeit -s 'from math import log' 'log(1.1)' 1000000 loops, best of 5: 344 nsec per loop $ ./python -m timeit -s 'from math import log' 'log(1.1, 3.2)' 500000 loops, best of 5: 601 nsec per loop After: $ ./python -m timeit -s 'from math import log' 'log(1.1)' 2000000 loops, best of 5: 171 nsec per loop $ ./python -m timeit -s 'from math import log' 'log(1.1, 3.2)' 1000000 loops, best of 5: 348 nsec per loop
rhettinger
pushed a commit
that referenced
this issue
Mar 21, 2023
My numbers: Before PR:
After PR:
|
Fidget-Spinner
pushed a commit
to Fidget-Spinner/cpython
that referenced
this issue
Mar 27, 2023
warsaw
pushed a commit
to warsaw/cpython
that referenced
this issue
Apr 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Uh oh!
There was an error while loading. Please reload this page.
In #64385 this functions was converted to the Argument Clinic. Unfortunately, the function signature was "corrupted", probably to prevent showing "magic number" 2.718281828459045 in the function docstring, and this has a noticeable speed impact (~2x regression). In the current main:
while without the AC stuff (but with METH_FASTCALL):
(A different "corruption" was used in the cmath.log, without noticeable speed regression. Unfortunately, it can't be adapted for the math module.)
Given that with the current "state of art" for the AC and the inspect module it's impossible to represent the math.log() correctly (see #89381) - I think it does make sense to revert the AC patch for this function. BTW, the math module has several other functions, that are not converted to the AC, e.g. due to performance reasons (like hypot(), see #30312).
Linked PRs
The text was updated successfully, but these errors were encountered: