lua-users home
lua-l archive

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


LuaJIT is great, but don't buy into JIT would rule over the rest of the stuff. Think about it as a tool, not as the silver bullet. There are always going to be faster ways to achieve something, given dedication to the problem. Use LuaJIT to solves general programming problems. So far it works very good for me.

What I find cool about JIT is really that you gain very good speed, and you don't have to worry about configurations (architecture), preprocessing (compilation, linking, etc.) + one can communicate using source code send over the network to get executed, rather than scripts that need to get compiled.

For example I'm sitting from on my Mac OS X book, and uploading scripts to my Efika MX SmartTop (ARM cpu), and they just work. But I had to spend some time finding proper (for me) "C" and "C++" libraries to use with it - ZeroMQ, OpenGL, GLES, GLFW, etc, and thanks to the awesome FFI I don't lose much speed (in fact it might be faster sometimes than called directly from "C" - not sure).

But you won't be able to use easily LuaJIT to speed up a DXT compression for example, while it takes just OpenMP and "C" to do it with one or two pragmas (split the image by 4x4 blocks, or 4xNNN rows, NNNx4 columns, and call the DXT encoding routine). Then again LuaJIT would allow me to easily encode this problem in another language - be it OpenCL, CUDA, or if needed call gcc and compile "C".

On 6/22/2011 4:48 PM, Fabio Kaminski wrote:
There 's a "common" believe that jitted code can(hypoteticaly) run
even faster than compiled code..

see the famous hp dinamo(1999) for some insights..

http://www.hpl.hp.com/techreports/1999/HPL-1999-78.html

there are optimizations in the output native binary that are only
possible with a dinamic compiler running and getting more
introspection..

so.. i think in the near future.. statically compiled code (like C)..
will eat some dust from jitted code in the benchmarks..as this happens
already in some corner cases..

so i think a real hacker .. would just embed luajit.a into its library
or binary.. and enjoy his code flying at the light speed..

luajit already create code almost fast as c (i think i saw a big
matrix multiplication other day with a lot of inner loops running even
faster than C ) and running a dinamic language..

i think soon we will be running luajit benchmarks against hand-coded
assembly just because no one else left .. :)


On Wed, Jun 22, 2011 at 7:33 PM, HyperHacker<hyperhacker@gmail.com>  wrote:
I was just wondering to myself if LuaJIT could ever be hacked to
function as a Lua compiler, that compiles scripts to standalone
executables or libraries. It'd be great if we could take advantage of
its speed and the FFI to write Lua extensions in Lua that would
normally have to be written in C... :)

--
Sent from my toaster.