lua-users home
lua-l archive

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


On Wed, Feb 25, 2009 at 11:13 AM, Asko Kauppi <askok@dnainternet.net> wrote:
> Maybe there should be yet another kind of hook, which string and gsub
> libraries etc. would trigger from their internal loops.

But you always can supply your own string.gsub after all...

> Or maybe the execution time limit should be completely detached from the
> debug API.

> It's fairly easy to make a portable "this function gives the execution time"
> setting for Lua compilation. But what and when should be done about that is
> another issue. The same mechanism could actually be used as a "performance
> counter" of sorts in Lua.

I think tracking *time* properly and portably would be too hard task
for Lua (also it should be a considerable performance hit).

...OTOH, it may make sense to have centralized abstract "operation
counter" with C API to increment it and to set hook on it a-la
instruction counter. Standard Lua libraries would increment them at
will. Instruction counter would be incremented in parallel with it.
Any sandbox-friendly 3rd party modules would increment the counter as
well on long operation loops. It would allow to register long
iterative operations for a sandbox in a centralized way.

Alexander.