[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_lock
- From: Veijo Vilva <vilva@...>
- Date: Fri, 14 Nov 1997 10:03:34 +0200
On Thu, Nov 13, 1997 at 05:05:48PM -0200, Roberto Ierusalimschy wrote:
> The Lua reference mechanism (Section 5.6 of the manual) has an
> option that allows C to keep a reference to a Lua object without preventing
> the GC to collect the object. Does anyone use this option? It was supposed
> to be useful in breaking 'reference cicles', when C keeps a reference to a
> Lua object and Lua keeps a reference to the C object (userdata), and then they
> would be never collected. But we are not sure whether anyone ever succeed in
> using it...
>
> -- Roberto
>
I have used it to achieve a moderate speed-up in a bytecode interpreter
iterating over largish datasets.
Instead of
lua_callfunction(lua_getglobal("my_lua_function"))
I have
lua_callfunction(ref_to_my_lua_function)
within the innermost loop.
Veijo
--
Veijo Vilva vilva@xiron.pc.helsinki.fi
Dept. Animal Science http://xiron.pc.helsinki.fi/people/vilva
P.O.Box 28 PGP public key available on ./vvpgp.html
FIN-00014 University of Helsinki Tel. +358 9 708 5584 | key ID = 6511C0AD