Hi Antoine,

I completed the PEP: https://python.github.io/peps/pep-0670/

* Add benchmarks on a Python debug build: (1) macros vs static inline
functions and (2) gcc -O0 vs gcc -Og
* Elaborate the Debug Build section
* Explain why the "keep macros" idea was rejected

Diff: 
https://github.com/python/peps/commit/570cea56c2fdb9f9b5873a0a83462816e641c52f

https://www.python.org/dev/peps/pep-0670/ will be updated soon.


>From what I understood, debug builds are mostly used by Python core
developers to develop Python and so an important use case for
performance is running the Python test suite.

(1) Replacing macros with static inline functions makes Python 1.04x
slower when the compiler **does not** inline static inline functions:
gcc -O0.

But developers using GCC and LLVM clang should get -Og when using
"./configure --with-pydebug".

(2) Python built with "gcc -O0" is 1.6x slower than Python built with "gcc -Og".

Well, don't use gcc -O0 if you care about performance :-)

I didn't run benchmarks on Python built in release mode, since gcc -O3
with LTO and PGO should inline all static inline functions and I don't
expect any difference between macros and static inline functions.


You can use my PR https://github.com/python/cpython/pull/29728 to run
your own benchmarks.

Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/THWYCMUEJHKHBQRP72OEUHTDFWYETV6P/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to