-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-102839: remove AC for math.log #102863
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
Conversation
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
math_log_impl(PyObject *module, PyObject *x, int group_right_1, | ||
PyObject *base) | ||
/*[clinic end generated code: output=7b5a39e526b73fc9 input=0f62d5726cbfebbd]*/ | ||
math_log(PyObject *module, PyObject * const *args, Py_ssize_t nargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment about why it is not converted to AC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I did.
Misc/NEWS.d/next/Library/2023-03-20-12-21-19.gh-issue-102839.RjRi12.rst
Outdated
Show resolved
Hide resolved
…jRi12.rst Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this is what we have to go.
See: faster-cpython/ideas#565
If and when the AC gets improved, we can convert this back to AC. In the meantime, let's take the performance win. We will see immediate benefits in some of the random module distribution calculations. |
@skirpichev My timings are about 7x faster than yours. Are you using a debug build for timings, a non-representative machine, or an older compiler? |
@mdickinson Are you on board with this? |
@rhettinger Yep, fine by me. Looks like a significant performance boost. |
In fact, it's possible to keep AC stuff, if we "corrupt" it like cmath.log:
at cost of slight change in the docstring. Not sure it worth, this just hide the problem with AC/inspect capabilities.
@rhettinger, perhaps, the second option. This was a usual ( |
Before:
After: