-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Build Python with frame pointers (-fno-omit-frame-pointer) #96174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It wouldn't hurt to run this change through pyperformance to help confirm the lack of performance impact. |
Please don't trust the unapproved Fedora change proposal too much. Especially its performance numbers: it seems that the flag was only enabled for a small subset of code when they were made. |
Idea: we could enable it by default and drop it with --enable-optimizations |
While I laughed when I read it, I'd actually be fine with that. We tell people to use that for the best speed. Linux distro packaging setups either use that or do an equivalent on their own at which point they'd need to adopt adding an explicit This is one of those compiler flags that makes code execution easier to passively analyze but always costs a little performance. The more registers the less impact on any given platform. ie: x86_64 should feel it more than ARM. We still build most everything at work with frame pointers. |
Also, the pitch should be about unwinders in general, not only the perf work. Perf is orders of magnitude slower without frame pointers and so is any other unwinder (like libunwind). Having to parse dwarf to unwind is super heavy on I/O and CPU. Everywhere this is discussed the pitch is to sacrifice just a tiny bit of perf for better debugging and profiling experience |
There's been a lot more discussion on the Fedora thread (https://lists.fedoraproject.org/archives/list/[email protected]/thread/OOJDAKTJB5WGMOZRXTUX7FTPFBF3H7WE/) as of the last few days - worth reading. As for Python, if it decides to do it, please restrict it to 64-bit arches (ideally just amd64 for now until others have been analysed). |
Feature or enhancement
I propose to build CPython with
-fno-omit-frame-pointer
and-mno-omit-leaf-frame-pointer
on compilers that support these options, at least on Linux with GCC and clang on platforms that support perf trampoline (#96143).Pitch
The feature is needed for #96143 "Allow the linux perf profiler to see Python calls". Otherwise perf won't be able to reconstruct the call frames and perf report output isn't helpful.
Previous discussion
The feature change proposal https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer explains the usefulness of frame pointers in great detail. Code without frame pointers can be slightly more efficient because it does not have to safe a register on function call and it can repurpose the register for other uses. The potential performance impact is discussed in the Fedora change proposal, too. tl;dr Fedora testing has not shown any significant impact.
The text was updated successfully, but these errors were encountered: