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...

http://www.google.ca/search?q=sjlj+cygwin+octave&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox&rls=org.mozilla:en-US:unofficial

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
program:

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

///////////////////////////////////////////////////////////////////////////////

void
foo()
{
    throw 5;
}

///////////////////////////////////////////////////////////////////////////////

int
main(int,char**)
{
    try
    {
        foo();
    }
    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!

-Adam

______________________________________________________________________ 
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