$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [Stacktrace] review
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2016-12-16 15:54:11
On Fri, Dec 16, 2016 at 11:05 AM, Niall Douglas <s_sourceforge_at_[hidden]>
wrote:
> I also looked up some benchmarks. A C++ and SEH exception throw and
> catch costs about 2 microseconds on x86 on MSVC back in 2011 on a
> fairly low end CPU for the time. x86 SEH still uses the old
> setjmp/longjmp mechanism i.e. each stack frame pushes its unwind
> handler and pops it off the stack after i.e. it is not a "zero
> runtime cost" exceptions implementation.
>
The added run-time cost of SEH is not because it uses a different throw
mechanism but because under SEH the compiler must assume that absolutely
any CPU instruction may result in throwing a C++ exception. In MSVC this
adds overhead at every function entry and exit, even functions that do not
use the throw keyword (as a side note, all his overhead isn't critical
because it can be avoided by inline, which one presumably would do anyway
in critical functions.)
Emil