[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: proposal: a specialized VM for numeric computation, called as a Lua library
- From: KHMan <keinhong@...>
- Date: Fri, 12 Mar 2010 13:52:57 +0800
David Manura wrote:
Here, "compile" would convert the given Lua-like code snippet to a
function object, under the assumption that all variables in the
snippet are local and of type number. These restrictions are made so
that the code can be compiled to a more specialized bytecode format
and interpreted under a specialized VM optimized for numeric code.
I doubt you'd get much of a speedup using interpretation. Too much
overhead. What kind of interpreted virtual instructions do you
have in mind that would be worth the effort to implement?
The language recognized by "compile" might also include extensions to
the Lua language, such as intrinsic operators like trigonometric and
bitwise, as you would see in a CPU and FPU. [snip] SSE-like ops may be added as well,
which can give some speedups even in ANSI C .
But in order to compile really efficiently, add all the hinting
and change all the normal rules and you'd end up with something
rather different from standard Lua -- a "Dr Jekyll" Lua and a "Mr
Hyde" Lua and you'd need another task switch for your programming
Is it worth the effort? I don't think it's going to win many
benchmarks. I don't see a clear 'win' here... anything that ends
up running native code will still be much faster.
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia