Optimized Python scripts to run approximately 27% faster on Fedora 32
Fedora 32, scheduled for release in April, is expected to surprise Python developers. The change introduction page of the Fedora project shows that when building the Python interpreter, the development team added a -fno-semantic-interposition flag, which will significantly improve performance. “It provides significant performance improvement, up to 27% depending on the workload. Users will no longer be able to use LD_PRELOAD to override a symbol from libpython, which we consider a good trade off for the speedup.”
Test cases such as nbody, scimark, django, and ray tracing improved performance by 20% to 27%, while performance measured by PyPerformance increased by 5% to 20%.
The change for users is that they will no longer be able to use LD_PRELOAD to overwrite symbols from libpython, but the official thinks this is a good compromise for speed.
It is understood that these improvements were originally developed for Fedora 32, and the developers of the Fedora project were working on a solution for statically linking Python to improve performance. Later, due to feedback from the community, they narrowed down the scope and only wanted to optimize Python in Fedora 32 and limit it to using -fno-semantic-interposition flags to build Python.