Boost logo

Boost :

Subject: Re: [boost] Gauging interest in patch submissions
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-09-28 17:07:47


On Wed, Sep 28, 2011 at 1:49 PM, GMan <gmannickg_at_[hidden]> wrote:
>>
>> On Wed, Sep 28, 2011 at 8:48 AM, Brett Lentz <blentz_at_[hidden]> wrote:
>> > 2. Adding backtrace and system_error_code support.
>> >
>> > This adds additional exception information to boost::thread_exception,
>> > boost::thread_resource_error, and boost::thread_interrupted that allows
>> > Passenger to dump a full backtrace all the way up its stack.
>>
>
> My only concern with this is in a case like this, for example:
>
> while (/* reading lines from file, parsing integers, otherwise ignoring*/)
> {
>    try
>    {
>        myInts.push_back(boost::lexical_cast<int>(currentLineStr));
>    }
>    catch (const boost::bad_lexical_cast&) // (has stack trace)
>    {}
> }
>
> Will the stack trace make such an operation noticeably slower?

No, it won't affect the speed of a catch by reference.

> I know it's
> easy to retort with "don't use exceptions for flow control" but I believe my
> concern is valid, even if it's a bit contrived of a situation.

Your concern might be valid in but it shouldn't be based on a belief.
Profile your code and see if the speed of exception handling has a
noticeable effect on performance.

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