Exceptions + Performance on path without exceptions

G

gratch06

The application I'm working on will run on Linux, in user space. If I
use exception handling in parts of the application, will that affect
the performance of sections of code which do not use any exception
handling? Basically, I'm looking at optimizing a critical path, and
wondering if I can keep the exceptions elsewhere in code which are
working fine.
 
P

peter koch

The application I'm working on will run on Linux, in user space. If I
use exception handling in parts of the application, will that affect
the performance of sections of code which do not use any exception
handling? Basically, I'm looking at optimizing a critical path, and
wondering if I can keep the exceptions elsewhere in code which are
working fine.

One common implementation of exception handling adds overhead only in
the case that an exception is thrown, and so far as I know gcc on
Linux uses that approach. In that case you should be safe in all the
unexceptional cases, but you'd need to measure before knowing for
sure, of course.

/Peter
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

The application I'm working on will run on Linux, in user space. If I
use exception handling in parts of the application, will that affect
the performance of sections of code which do not use any exception
handling? Basically, I'm looking at optimizing a critical path, and
wondering if I can keep the exceptions elsewhere in code which are
working fine.

First of all, do you have any reason (such as measurements) to believe
that your code is losing execution-speed due to exceptions? Don't forget
the golden rule of optimization: measure first.

Some compilers allow you to turn off exceptions, so if you can compile
the critical code without exceptions and the other with it might solve
the problem for you. But it probably means creating special rules in
your Makefiles or whatever you are using.
 
S

Sherm Pendley

The application I'm working on will run on Linux, in user space. If I
use exception handling in parts of the application, will that affect
the performance of sections of code which do not use any exception
handling? Basically, I'm looking at optimizing a critical path, and
wondering if I can keep the exceptions elsewhere in code which are
working fine.

You must have used a profiler to identify the critical path, right? What
did the profiler say about the code you're asking about?

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error codes vs. exceptions 135
Exceptions 1
Exceptions 10
C++ Exceptions Cause Performance Hit? 59
those darn exceptions 13
pyprocessing and exceptions 1
Debug exceptions 5
augmented exceptions 1

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top