Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] review
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2016-12-16 15:41:04

On Wed, Dec 14, 2016 at 11:46 PM, Niall Douglas <s_sourceforge_at_[hidden]>

> On 15 Dec 2016 at 15:01, Gavin Lambert wrote:
> > > I've not taken a look at the proposed Stacktrace library, but from what
> > > I know obtaining a stacktrace is typically a rather expensive
> operation.
> > > I expect it to be no less expensive than throwing the exception. That's
> > > probably too much to pay for by default. Plus, it adds one more
> > > dependency on another library via such a core component as
> For a capture depth of seven frames, it costs about 30 microseconds
> on Microsoft Windows. Stack backtracing is inherently cache
> unfriendly. That is a lot more than throwing an exception.
> The people on SG14 have tried quite hard to demonstrate that throwing
> exceptions is slower than alternatives, but it has proven
> surprisingly hard to conclusively prove it in real world code. I am
> sure the compiler vendors would say "I told you so ..."


> > Capturing the stack to later perform a trace is relatively cheap and
> > fast (though perhaps memory wasteful, though you usually wouldn't care
> > about that unless the exception was due to running out of memory). It's
> > interpreting that data into a human-readable trace that's the slow part.
> Multiple orders of magnitude difference yes.


With regards to integration into boost::throw_exception, obviously we only
need to capture the data not format it.


Boost list run by bdawes at, gregod at, cpdaniel at, john at