lua-users home
lua-l archive

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


> Many threads might want to use the compiled function at the same time on different inputs.  Each could have its own state, with a copy of the compiled function and the different inputs.

As I suspected. I very much doubt that the compilation cost is
comparable to cost of creating these states per thread, or of running
the function, or that you have done any benchmarking.

Personally, I'd strongly sugget lua_load()ing the lua source into each
state and pcalling it, and prove the compilation is a performance
problem, and prove to yourself luajit doesn't erase those problems,
before trying to ferry around compiled byte code.

Also, be aware that compiled byte code can be crafted to crash the lua
vm. lua source is the best form for loading lua code into a state.

Cheers,
Sam