Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm confused: the article includes concerns about "performance". Is the performance hit noticeable in the final binary (i.e. the one I'm running when I `dnf install` the RPM), or is it only during the source compilation?

If it's the latter, I don't see why it's a big deal. If it's the former, I'd love to know why the frame stack version of the program would run more slowly.




The performance hit (~2%) is observable at runtime, assuming you're doing things which are CPU bound. For cpython programs the especially large hit (~10%) is well understood though not fixed: https://pagure.io/fesco/issue/2817#comment-826636

The flip side to this is that when you have good profiling it changes how you write and debug software. You can actually look at the whole system (eg with Flamegraphs https://www.brendangregg.com/flamegraphs.html) and find out what's taking all the time, and hopefully direct your fixes to the right place. This potentially gives you great performance benefits. Apparently Meta recompile all software with frame pointers and use perf to do this kind of analysis.


> If it's the former, I'd love to know why the frame stack version of the program would run more slowly.

I believe it's the former and my understanding is that the stack frame version uses a register (RBP on x86-64) to keep track of the (start?) of the stack frame, which presumably helps in debugging / getting stack traces and profiling performance.

However, when not keeping track of the stack frame, the compiler can use the RBP register for storing other values, which means that the compiler has one more register it can use to avoid loading/storing values in memory (accessing memory is much slower than accessing registers).

Also, when not keeping track of the stack frame, I believe there is less of a need to store/restore the value of RBP at the beginning/end of functions, which also reduces code size and number of instructions executed, I think.

As far as I understand, those are the reasons for the slowdown.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: