Re: Does debug flag impact a c++ application performance? (132 Views)
Reply
Occasional Advisor
Paulo123
Posts: 8
Registered: ‎01-08-2010
Message 1 of 7 (132 Views)
Accepted Solution

Does debug flag impact a c++ application performance?

Hi,

I compiled my c++ application with -g0 +d flags.

The compiler I use is aCC.

After compiling with this flags the performance decreased.

As I also others changes in the application, I would like descarting that debug flags is the problem.

Does debug flag impact a c++ application performance?

Thanks in advanace
Please use plain text.
Honored Contributor
Steven Schweda
Posts: 9,079
Registered: ‎02-23-2005
Message 2 of 7 (132 Views)

Re: Does debug flag impact a c++ application performance?

> Does debug flag impact a c++ application
> performance?

It might reduce it. If adding the debug
flags _improved_ performance, then wouldn't
everyone use them always?

If nothing else, I'd expect the executable
to be bigger, so that loading it would use
more virtual memory (which seems unlikely to
help performance). Then, generally, when
compiling for debug, most people use less (or
no) compiler optimization, so that a debugger
can better correlate instructions in the
executable with lines in the source code.

> [...] I would like [...]

Why not run the experiment, and see what
happens?
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,896
Registered: ‎03-06-2006
Message 3 of 7 (132 Views)

Re: Does debug flag impact a c++ application performance?

>Does debug flag impact a C++ application performance?

No, not with -g*, only with the long dead cfront.

>I compiled my C++ application with -g0 +d flags.

But turning off inlining with +d will have a negative impact.

>Steven: I'd expect the executable to be bigger, so that loading it would use more virtual memory

No, debug info is not loadable.

>generally, when compiling for debug, most people use less optimization, so that a debugger can better correlate instructions in the executable with lines in the source code.

Yes. Otherwise if you use +Ox, -g has no effect.
Please use plain text.
Occasional Advisor
Paulo123
Posts: 8
Registered: ‎01-08-2010
Message 4 of 7 (132 Views)

Re: Does debug flag impact a c++ application performance?

The problem is, I have a coredump problem (production enviroment), and I can't debug my core file because the application is not compiled with debug flags.

So I compiled the application with -g0 +d to have those informations.

But in production the performance decreased.

So, what's the better option I have to compile with debug flag without impact the application performance?

Thanks

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,896
Registered: ‎03-06-2006
Message 5 of 7 (132 Views)

Re: Does debug flag impact a c++ application performance?

>I have a coredump problem (production environment), and I can't debug my core file because the application is not compiled with debug flags.

Can you provide a stack trace?

>So I compiled the application with -g0 +d to have those info.

You should try to debug without +d.

>what's the better option I have to compile with debug flag without impact the application performance?

Why do you care about performance if you are debugging? You add -g0, debug, then remove it. Or do you need to debug at remote sites, for your customers?
Please use plain text.
Occasional Advisor
Paulo123
Posts: 8
Registered: ‎01-08-2010
Message 6 of 7 (132 Views)

Re: Does debug flag impact a c++ application performance?

>Can you provide a stack trace?

I know what's happening in the coredump, but I need the information of some variables to fix it.

>You should try to debug without +d.

Ok, without +d I can have the same performance between -g0 and without -g0.

>Why do you care about performance if you are debugging?

Because the coredump just occurs in my customer enviroment. In addition, different coredumps frequently occurs, so I need that my application always runs with debug flag, to help me to analyse core files.
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,896
Registered: ‎03-06-2006
Message 7 of 7 (132 Views)

Re: Does debug flag impact a c++ application performance?

>I know what's happening in the coredump,

It's in your code and it's obvious?

>without +d I can have the same performance between -g0 and without -g0.

Yes.
I assume you know about +noobjdebug?

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation