Performance of exception handling

Alexander aldem+dmars at nk7.net
Tue Apr 26 05:43:26 PDT 2011


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


More information about the Digitalmars-d mailing list