I am using a package that is compiled using gcc -O3 -g
.
Since some function calls to that code are the slowest part of my program I am wondering if the -g
could be the culprit? Or should it not matter in terms of runtime?
I am using a package that is compiled using gcc -O3 -g
.
Since some function calls to that code are the slowest part of my program I am wondering if the -g
could be the culprit? Or should it not matter in terms of runtime?
Since -O3 implies aggressive inlining, and -g implies avoiding inlining so that the debugger can have function addresses, those options are somewhat at odds. Nevertheless in general -O3 wins, and aside from a somewhat larger binary -- and the minor speed effects that might come from paging or nonlocality -- it should not make much of a difference.
-g
will make your code bigger (added space for debug symbols) and will disable some optimizations like inlining, but probably not appreciably slower.
If your real question is "Why is it slow?" there's an easy way to find out.