nginx - Compile Lua scripts used on OpenResty -


i'm using openresty + lua several projects, , flexibility lua gives me, in fact wrote micro-web apps directly in lua scripts, served nginx-openresty.

but, if want distribute web app, lua code should either "plain" or, @ least, obfuscated. instead, considering luajit i'm using compiles lua native code, possible pre-compile lua scripts native code (not lua .o object files), , load them in openresty, instead of direct .lua source files?

nope.

there's no way compile luajit code machine code. doesn't work way, 2 main reasons:

  1. luajit selects traces compile based on how ran @ runtime. means generated traces can change depending on data being processed (ex. different if branches can compiled depending on 1 taken more often). thus, it's impossible precompile them ahead of time.
  2. some operations cannot compiled, because hasn't been implemented yet (ex. closure creation), not ever in areas worth optimizing (ex. require), or because it's not possible (ex. calls lua c api functions)

your best bet compile lua files luajit bytecode debugging info stripped instead. means stuff local variable names, line numbers, etc. omitted, can still disassembled.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -