Hello!
On Wed, Jan 14, 2015 at 1:46 AM, Sam Wong wrote:
>
> is it already lua jitted or do i have to do the luajit bytecode myself?
>
Compiling Lua source to the LuaJIT bytecode and compiling LuaJIT
bytecode to native machine code are two separate phases and the former
is always done automatically while *loading* the Lua source code
before running it while the latter only happen later on hot enough Lua
code paths while *interpreting* the LuaJIT bytecode. The process is
illustrated by the following image:
http://agentzh.org/misc/slides/nginx-conf-2014/images/luajit-code-flow.jpg
Note that, not all LuaJIT bytecodes are supported by the JIT compiler.
The JIT compilation can abort when the JIT compiler sees some
primitives that it does not (yet) support. Such primitives are called
"NYI": http://wiki.luajit.org/NYI Generally you need to work-around
such NYI to compile as much your hot Lua code paths as possible.
To actually verify how well the JIT compiler is doing (that is,
compiling hot bytecode to native machine code), you need to use the
jit.v and/or jit.dump Lua modules shipped with LuaJIT by default
(which are also exposed by the -jv and -jdump command-line options of
the standard "luajit" command-line utility).
Regards,
-agentzh