Boost logo

Boost :

Subject: Re: [boost] [inspect] exceptions (FW: [Boost-users] no exceptions)
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-03-25 20:51:58


On Fri, Mar 25, 2011 at 3:22 PM, Gruenke, Matt <mgruenke_at_[hidden]> wrote:
> On Fri 3/25/2011 2:54 PM, Emil Dotchevski wrote:
>> Honestly, I've never measured the speed of throwing and catching any
>> exceptions on any platform -- I tend to focus on whatever the profiler
>> points me to.
> It's when you start insisting that it must be used everywhere that something like 50% overhead can start to be a problem.  It just might be that exceptions are a hot spot, in a particular design or context (maybe Boost.Python is a good example?).

First, let's get on the same page about the nature of the cost of
BOOST_THROW_EXCEPTION:

- It adds ~500 lines of C++ code, increasing your compile times.
Compare this to something as basic as boost/config.hpp, which
preprocesses to ~47000 lines on my system.

- If you wanted to throw T, it throws U:T,B instead. Even if this
makes catch(T&) slower, catching exception objects by a base type is
quite common.

Second, consider that this is only the default behavior. All this
functionality disappears if you #define BOOST_EXCEPTION_DISABLE.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk