Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

Here are two timings for math.dist().  They were run with the production macOS 
builds from python.org:

$ python3.8 -m timeit -r 11 -s 'from math import dist' -s 'p=(1.1, 2.2); 
q=(1.7, 2.3)' 'dist(p, q)'
5000000 loops, best of 11: 58.4 nsec per loop

$ python3.9 -m timeit -r 11 -s 'from math import dist' -s 'p=(1.1, 2.2); 
q=(1.7, 2.3)' 'dist(p, q)'
5000000 loops, best of 11: 66.9 nsec per loop

The attached screen shot shows that the only change between the two versions is 
that the subclass check is inlined and fast in 3.8, but is an external function 
call in 3.9.

---- 3.8 subclass check -----------
    movq    8(%r12), %rax
    movl    $0, 32(%rsp)
    testb   $4, 171(%rax)
    je  L779

---- 3.9 subclass check -----------

    movq    8(%r12), %rdi
    call    _PyType_GetFlags
    movl    $0, 32(%rsp)
    testl   $67108864, %eax
    je  L856

The C code for math.dist() is unchanged between 3.8 and 3.9.  Both use 
PyTuple_Check().

This isn't unique.  Every single PyTuple_Check() is the similarly affected 
(approx. 225 occurrences).  Presumably, this affects other type checks as well.

----------
Added file: https://bugs.python.org/file49303/Screen Shot 2020-07-07 at 
10.40.52 AM.png

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39542>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to