根据我的理解,标准的Lua解释器首先将输入代码编译为“字节码”( luac的输出),然后“解释”该字节码。
但这基本上不是JIT编译器的定义吗? 那时LuaJIT做了什么? 它与标准的Lua解释器有何不同? 怎么会这么快?
From what I understood, the standard Lua interpreter first compiles the input code to "bytecode" (the output of luac) and then "interpretes" that bytecode.
But isn't that basically the definition of a JIT compiler? What does LuaJIT do then? How does it differ from the standard Lua interpreter? How can it be this faster?
最满意答案
基本上不是JIT编译器的定义吗? 那时LuaJIT做了什么?
它实现了自己的解释器,它通常比“标准”Lua解释器更快,并且JIT将频繁访问的片段编译为机器指令,这带来了进一步的性能提升,但限制了可移植性(因为这些指令是机器/体系结构特定的) 。
还有更多的改进和优化,您可以在Mike Pall的概述中找到它们。 另请参阅此页面以了解整个JIT讨论 ,特别是Mike Pall对此的评论 。
isn't that basically the definition of a JIT compiler? What does LuaJIT do then?
It implements its own interpreter, which is often faster than the "standard" Lua interpreter and it JIT-compiles frequently visited fragments to machine instructions, which brings further performance gains, but limits the portability (as those instructions are machine/architecture-specific).
There are many more improvements and optimizations, which you can find in Mike Pall's overview. Also see this page for the overall JIT discussion and specifically Mike Pall's comments on it.
更多推荐
发布评论