On Tue, Jun 30, 2020 at 6:45 AM Raymond Hettinger <raymond.hettin...@gmail.com> wrote: > > > > Converting macros to static inline functions should only impact very few > > C extensions which use macros in unusual ways. > > These should be individually verified to make sure they actually get inlined > by the compiler. In https://bugs.python.org/issue39542 about nine PRs were > applied without review or discussion. One of those, > https://github.com/python/cpython/pull/18364 , converted PyType_Check() to > static inline function but I'm not sure that it actually does get inlined. > That may be the reason named tuple attribute access slowed by about 25% > between Python 3.8 and Python 3.9.ยน Presumably, that PR also affected every > single type check in the entire C codebase and will affect third-party > extensions as well. >
I confirmed the performance regression, although the difference is 12%. And I find the commit cause the regression. https://github.com/python/cpython/commit/45ec5b99aefa54552947049086e87ec01bc2fc9a https://bugs.python.org/issue40170 The regression is not caused by "static inline" function is not inlined by compiler. The commit changed PyType_HasFeature to call regular function PyType_GetFlags always. Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ 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/FOKJXG2SYMXCHYPGUZWVYMHLDR42BYFB/ Code of Conduct: http://python.org/psf/codeofconduct/