| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
If it requires to make tests less strict, it is potentially breaking change, and therefore it should be mentioned in What's New.
Sorry, something went wrong.
| for (i=0 ; i < n ; i++) { | ||
| x = vec[i]; | ||
| assert(Py_IS_FINITE(x) && fabs(x) <= max); | ||
| x *= scale; |
There was a problem hiding this comment.
What is faster, x *= scale or x = ldexp(x, -max_e)?
Sorry, something went wrong.
There was a problem hiding this comment.
The test as written was over-specified. It should have been written this way from the start.
The x *= scale is faster than x = ldexp(x, -max_e). The former is a single, fast in-line instruction and the latter is an external library call.
Here's the generated code for the loop:
L284:
movsd (%r12,%rax,8), %xmm0
addq $1, %rax
cmpq %rax, %rbp
mulsd %xmm4, %xmm0 <-- x *= scale
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1 <-- x *= x
movapd %xmm2, %xmm0
addsd %xmm1, %xmm2 <-- csum += x
subsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd %xmm0, %xmm3
jg L284
subsd %xmm
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
https://bugs.python.org/issue41513