lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
Unfortunately, with a one-pass compiler, by the time a return is compiled
we cannot be sure that there won't be a sub-proto later. For instance,
consider a code like this:

It can be implemented in the vm though, try benching the current implementation:

if (L->openupval) luaF_close(L, base);
vs
if (L->openupval && cl->p->p) luaF_close(L, base);
or
if (cl->p->p) luaF_close(L, base);

Although probably a minor point in real world use, is quite measurable on the recursion compiler shootout benches. (And yes, probably is a bad idea to optimize a vm based on synthetic benchmarks, but interesting nonetheless?). (may make more sense to simply rewrite those code pieces such that they close all upvalues before running the functions, which results in similar speedup).

- Alex