Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Exceptions + Performance on path without exceptions (http://www.velocityreviews.com/forums/t501641-exceptions-performance-on-path-without-exceptions.html)

gratch06@gmail.com 04-16-2007 05:23 PM

Exceptions + Performance on path without exceptions
 
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.


peter koch 04-16-2007 07:10 PM

Re: Exceptions + Performance on path without exceptions
 
On 16 Apr., 19:23, gratc...@gmail.com wrote:
> 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?= 04-16-2007 07:15 PM

Re: Exceptions + Performance on path without exceptions
 
On 2007-04-16 19:23, gratch06@gmail.com wrote:
> 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.

--
Erik Wikström

Sherm Pendley 04-16-2007 08:52 PM

Re: Exceptions + Performance on path without exceptions
 
gratch06@gmail.com writes:

> 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--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


All times are GMT. The time now is 10:13 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.