2

Using gcc on Ubuntu, should there be a (speed) performance difference if compiling the code with:

gcc -O3 prog.c

or:

gcc -O3 -g prog.c

IOW, does the insertion of debug information slows down the executable?

ysap
  • 7,723
  • 7
  • 59
  • 122

1 Answers1

3

Yes, it can slow down the executable a bit. Also, stack and control flow-related optimizations will be disabled when using -g.

See this SO post as a possible duplicate: How Does The Debugging Option -g Change the Binary Executable?

Community
  • 1
  • 1