Re: Fedora 32 System-Wide Change proposal: Build Python 3 to statically link with libpython3.8.a for better performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Where are these number coming from?

There are pyperformance results:
https://fedoraproject.org/wiki/Changes/PythonStaticSpeedup#Benefit_to_Fedora

It's the official benchmark suite to measure the Python performance on speed.python.org.

I ran the benchmarks on my laptop using CPU isolation (isolcpus and rcu_nocbs Linux kernel parameters).

> And what is the reason for the performance hit for dynamically linked Python?

Honestly, the speedup doesn't make any sense to me :-D But I only trust benchmark results, not beliefs nor documentations about compilers and linkers.

I looked at the assembly to compare statically linked and dynamically linked "python3.8" binaries. I noticed two main differences:

* function calls in dynamically linked Python use the PTL thing: it's not a direct function call, there is an indirection
* I see inlining more often in the statically linked Python

Reminder: currently (dynamically linked Python), /usr/bin/python3.8 is basically just a single function call to Py_BytesMain(argc, argv). ALL Python code lives in libpython.

I cannot explain why inlining cannot be done more often in libpython.

I cannot explain why PLT is needed when a libpython function calls a libpython function.

> Yea. This sounds like a bug/deficiency in the linking system, and the
> problem is possibly attacked from the wrong direction.

IMHO compilers and linkers are doing their best to optimize libpython, but the nature of libpython (a dynamic .so library) prevents some kinds of optimizations.

It seems like putting all code into an *application* allows to go further in term of optimization.

By the way, the two binaries that I analyzed are optimized using LTO (Link Time Optimization) *and* PGO (Profile Guided Optimization). They are the most advanced optimizations technics!

Victor
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux