[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Recycling the lua_load() output
- From: Sam Roberts <vieuxtech@...>
- Date: Thu, 13 Jan 2011 20:56:41 -0800
> 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.