This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How does the gcc -g option affect performance?
Ha, yeah. Sorry. Of course you're right. I also neglected to
mention that when I compile with -g I don't compile with
optimizations. I've heard that bad things can happen when you do
that? I guess because then registers can be used for variables and
it's not possible for the debugger to always get at the data?
Yeah, so that's probably accounting for most of the slow down. Also,
I had a temporary brain fart and was lumping data and and instruction
stuff together... please ignore my previous post ;)
Brian
On Thu, 03 Mar 2005 09:48:18 -0500, Daniel Berlin <dberlin@dberlin.org> wrote:
> On Thu, 2005-03-03 at 15:19 +0100, Brian Budge wrote:
> > Yes, there's a large performance penalty. (1) most optimizations
> > can't be done because they foo with the debug data, thereby hurting
> > debuggability
>
> What?
>
> -g will not change what optimizations are run, or code generated.
> This is gcc policy.
>
> > (2) bloated code is slow code.
> >
> Not really. It won't be loaded into memory unless it's used.
>
> > Normally I expect my code to run about an order of magnitude slower with -g.
> >
> Then something is very very wrong.
>
>