[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Debug hooks and the "line" string
- From: Mike Pall <mikelu-0703@...>
- Date: Tue, 13 Mar 2007 22:45:37 +0100
Hi,
Ivan-Assen Ivanov wrote:
> I don't know much about the internals of the interpreter, but
> it seems to me that by keeping these few strings alive and just
> giving out references to it the debug hook system will keep
> working in exactly the same way, without a noticeable increase
> in either code complexity or runtime memory footprint, and with
> a varying performance gain for everyone using the debug hooks.
The point is not about keeping these particular strings alive.
They are usually alive. But this can only be detected by computing
the hash (the expensive part of luaS_newlstr). One solution is to
store them in the registry at fixed indexes or something like
that. But ...
> Am I missing something?
Maybe. ldblib.c is only a _minimal_ wrapper around the C API for
debugging the Lua core. It is neither intended for nor completely
sufficient to write a fully-fledged and performant debugger. So
there's little point in optimizing these wrappers. You need to
write (at least) the lowest level functions directly in C using
the lua_*() debug API.
Another key insight is to _avoid_ using the line hook for as long
as possible. Here's a previous posting which outlines a way to
write a pretty efficient debugger (using the C API):
http://lua-users.org/lists/lua-l/2007-03/msg00016.html
Maybe Eike Decker is willing to share his code. Even if it's just
some code fragments, everyone can only benefit.
Bye,
Mike