c++ code executes very slowly - sjlj EH to blame?

Adam McKee adam_m_mckee@yahoo.ca
Wed Dec 15 22:23:00 GMT 2004

My app runs about 6 times faster on linux than cygwin,
even though it spends the bulk of its time doing pure
computation in user-space: strace shows a minimum of
system calls being made.  Profiling shows that the
culprit could be sjlj (set-jump/long-jump) EH.

After googling around a bit, I found that other folks
seem to have had a similar experience...


I built gcc-3.3.4 with same options as the cygwin gcc,
except I used "--disable-sjlj-exceptions".  With my
shiny new compiler, I compile and link the following

---- CUT HERE ---------------------------------------
#include <stdio.h>


    throw 5;


    catch (int)
        printf("exception caught\n");
    return 0;
--- CUT HERE -----------------------------------------

The result is that the program aborts when the
exception is thrown -- eh_terminate is called, but I'd
really prefer to throw an exception in the usual way
(but using the more efficient DWARF2 EH).

I also built a mingw32 cross-compiler, and rebuilt
cygwin, but the above program still aborts.

Does anyone know how to build a gcc/g++ that use
DWARF2 EH, instead of ... what we might call "abort()"
EH?  I would very much like to try this out - to see
if it will bring performance of my app on cygwin out
of the toilet.

Also - is it likely that cygwin will move away from
sjlj EH soon?  Of course, if the reason for the
amazing slowdown can be determined, that would perhaps
lessen the urgency to move away from sjlj.  sjlj
*should* be slower, but 6x is too high of a constant
for me to stomach.  Of course, that's assuming that
sjlj is to blame, which I won't know for sure until I
can build gcc with dwarf2 EH.  gprof output is
interesting and helpful - but can be misleading due to
rounding errors.

I will appreciate any help very much!


Post your free ad now! http://personals.yahoo.ca

Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list