How do debug symbols affect performance of a Linux executable compiled by GCC?

前端 未结 2 1619
感动是毒
感动是毒 2020-12-15 17:06

All other factors being equal (eg optimisation level), how does having debug symbols in an ELF or SO affect:

  1. Load time.
  2. Runtime memory footprint.
2条回答
  •  佛祖请我去吃肉
    2020-12-15 17:13

    You might want to look at Why does my code run slower with multiple threads than with a single thread when it is compiled for profiling (-pg)? for a quick explanations of how the debug symbols could affect optimization.

    To answer your 3 questions:

    1. Load time will be increased when the debug symbols are present over when not present
    2. The on-disk footprint will be larger
    3. If you compiled with zero optimization then you really lose nothing. If you set optimization, then the optimized code will be less optimized because of the debug symbols.

提交回复
热议问题