2014-12-10 19:38 GMT+01:00 Szabó Antal <szabo.antal.92@xxxxxxxxx>: > > As far as I can tell, this is the shortest and fastest you can get without > using vector instructions, which LuaJIT doesn't currently support. > Actually, if you run the loop from 9999 down to 0, you can get down to 3 instructions per loop: ->LOOP: 7ffc840dff80 addsd xmm7, [rax+rdi*8+0x8] 7ffc840dff86 add edi, -0x01 7ffc840dff89 jge 0x7ffc840dff80 ->LOOP Also, the way you want to compile a lua script into an executable is impossible with LuaJIT, it's a tracing JIT, which means it only compiles parts of the code which is executed frequently, the rest is interpreted.