[issue32616] Significant performance problems with Python 2.7 built with clang 3.x or 4.x

INADA Naoki report at bugs.python.org
Thu Feb 8 22:54:25 EST 2018


INADA Naoki <songofacandy at gmail.com> added the comment:

I don't know exactly.  But as far as I saw, Python 3's eval loop has less function-wide local variables.

For example, ROT_THREE uses only block local variable.
https://github.com/python/cpython/blob/a48e78a0b7761dd74f1d03fc69e0f6caa6f02fe6/Python/ceval.c#L1109-L1111

On the other hand, there are more function-wide local variables in Python 2.  And some of them are used over `case`s actually.
https://github.com/python/cpython/blob/672fd7d8162f76aff8423fa5c7bfd2b1e91faf57/Python/ceval.c#L802-L807


I suspect that's why LLVM4 failed to optimize Python 2 but success to optimize Python 3.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32616>
_______________________________________


More information about the Python-bugs-list mailing list