lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

David Given wrote:
> Incidentally, the original poster said that he was using gcc, not Visual C++, 
> which is what I originally thought. This surprises me; what optimisation 
> flags are you using?

The default from the distribution (-O2) and of course the same flags
for gcc and g++. But the C++ frame unwind code that takes up most of the
time is hidden inside libgcc and libstdc++.

I took a peek at the gcc source and immediately felt a big relief that
I never had to write a C++ exception handling mechanism myself.


But getting back to the original topic of this thread (*cough*):

Originally my patch threw an exception on _every_ yield. This simplified
the code quite a bit. But then I discovered the slowness of the C++
exception mechanism. And even a single longjmp seems to be slower than
returning from 5 frames, including 3 conditional jumps (although longjmp
on x86 is really only a handful instructions).

This made me consider the dual approach to the yield problem: Manually
unwind wherever possible -- throw an exception only when there is an
intervening C call boundary.

Bye,
     Mike