Performance of exception handling
Denis Koroskin
2korden at gmail.com
Tue Apr 26 06:10:34 PDT 2011
On Tue, 26 Apr 2011 16:43:26 +0400, Alexander <aldem+dmars at nk7.net> wrote:
> On 26.04.2011 12:57, Vladimir Panteleev wrote:
>
>> On my Windows box with an i7 920, a simple try/throw/catch loop runs at
>> about 130000 iterations per second.
>
> Well, g++ with same loop on same linux system gives ca. 160000 iter/s,
> which is quite OK for me.
>
>> Perhaps DMD doesn't use SEH on Linux, and instead uses setjmp/longjmp?
>
> I've not found any references to setjmp/longjmp, but what I've found -
> disabling trace
> handler with "Runtime.traceHandler = null" boost performance
> significantly - in my case
> I got 1600000 iter/s (wow!), which is perfectly OK.
>
> AFAIK, traceHandler is something that prints out the stack trace,
> providing valuable
> information only when there is no catch. If there is a catch, then,
> obviously,
> this slows down exception processing significantly without any need
> (it is called
> on every invocation of throw).
>
> I am right?
>
> /Alexander
Full stack trace resolving could be done lazily, but you need to save call
stack addresses at throw side (which is very quick anyway).
Could you please file a bugzilla enhancement request for that?
More information about the Digitalmars-d
mailing list