lua-users home
lua-l archive

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


Hi,

David Burgess wrote:
> > Document that compiling the Lua core with C++ exceptions makes throwing
> > errors dead slow.

I should note that this is _not_ caused by my patch and has not changed
at all (it just was not documented and affects not only Lua).

There is a story behind it:

For testing I compiled the Lua core with C++ and tried one of my test cases
that does pcall/error in a loop. Ok, so it got stuck apparently and I had
to start the debugger ... only to wade through gobs and gobs of unwind
functions in the C++ runtime. It took me another 5 minutes of debugging
until I realized that it was not stuck at all ...

One million setjmp/longjmp plus the surrounding overhead easily complete
in one and a half seconds on my machine.

But one million C++ try/catch/throw need more than a minute (!) to complete.
Yuck!

> I am (sadly) a VC6 user.
> The problem here is that anobject() does not have its destructor called.

Uh, oh. I guess you need a real VC6 expert to solve this.

I managed to refuse to code anything in C++ for the past 15 years (they
called me a fool back then), so I'm hardly qualified to answer.

Anyway, unless you throw tons of errors (just catching them is ok), there
is no need to worry. Compile everything with C++ and your problem goes
away.

Bye,
     Mike