Operating System - HP-UX
1752762 Members
4980 Online
108789 Solutions
New Discussion юеВ

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

 
SOLVED
Go to solution
Paulo123
Occasional Advisor

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
6 REPLIES 6
Steven Schweda
Honored Contributor

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?
Dennis Handly
Acclaimed Contributor

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.
Paulo123
Occasional Advisor

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

Dennis Handly
Acclaimed Contributor
Solution

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?
Paulo123
Occasional Advisor

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.
Dennis Handly
Acclaimed Contributor

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?