| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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.
Can you please add a comment about why it is not converted to AC?
Sorry, something went wrong.
There was a problem hiding this comment.
Ok, I did.
Sorry, something went wrong.
…jRi12.rst Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
There was a problem hiding this comment.
I don't think that this is what we have to go.
See: faster-cpython/ideas#565
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
@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? |
Sorry, something went wrong.
|
@mdickinson Are you on board with this? |
Sorry, something went wrong.
|
@rhettinger Yep, fine by me. Looks like a significant performance boost. |
Sorry, something went wrong.
In fact, it's possible to keep AC stuff, if we "corrupt" it like cmath.log: /*[clinic input]
math.log
x: object
base: object = NULL
/
log(x[, base=math.e]) -> the logarithm of x to the given base.
If the base not specified, returns the natural logarithm (base e) of x.
[clinic start generated code]*/
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 (./confiqure -q && make -s) build with gcc Debian(bullseye) 10.2.1-6. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Before:
After: