Boost logo

Boost :

Subject: Re: [boost] [inspect] exceptions (FW: [Boost-users] no exceptions)
From: Gruenke, Matt (mgruenke_at_[hidden])
Date: 2011-03-25 05:34:04


On Fri 3/25/2011 12:58 AM, Emil Dotchevski wrote:

> On Thu, Mar 24, 2011 at 8:03 PM, Gruenke, Matt <mgruenke_at_[hidden]> wrote:
> > I did a little bit of performance testing and found BOOST_THROW_EXCEPTION to add
> > about 45% overhead (CPU: Intel Xeon X5570; compiler: gcc-4.2.3; optimization: -O2) vs
> > straight 'throw' of simple std::exception-derived class. So, it's not exactly free.
> > That said, neither is blazingly fast.
>
> Could you clarify, what do you mean by overhead? Speed? Speed of
> throwing an exception? Speed of catching an exception? Code size?
> Compilation time?
 
I was talking about the CPU overhead of throwing + catching an exception. The time was essentially all userspace. If you recall, my point was that library-internal exceptions are an example of a case where there's no benefit to using the wrapper. If the wrapper had no cost and imposed no other constraints, then there wouldn't be an argument against requiring it. So, what I set out to do was to determine whether it does add significant overhead. We already know that it imposes other requirements and constraints.
 
BTW, I did not compare against an exception not derived from std::exception, yet it's quite plausible that an internal exception might not otherwise do that. That might reveal even more overhead.
 
 
Matt
 




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