Writing a Debugger from Scratch: Stacks
timdbg.com
timdbg.com
Discussion for part-5 (Breakpoints): https://news.ycombinator.com/item?id=37670938 (320 points | 57 days ago | 51 comments)
> You'd think that saving a whole register would mean a performance improvement, right? Especially on 32-bit x86 code where registers are at a premium. But it turns out that the cost savings are really pretty neglible. A Microsoft research paper from 2009 talks about measurements that were made in the performance of Windows with and without frame pointers. They found that there was no statistically provable benefit of FPO, and it was decided to disable FPO in Windows XP SP2! A similar investigation was done by Fedora and it was found that performance was typically only 2% different. When Meta enabled frame pointers sometime around 2017, they compared performance between a comparable set of hosts with and without FPO and found no difference.
> So why do we continue using FPO? Probably to make life more difficult for people who write debuggers.
[1] https://www.polarsignals.com/blog/posts/2022/11/29/dwarf-bas...
[2] https://www.polarsignals.com/blog/posts/2023/10/04/profiling...