[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua-5.0 performance problems
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 02 Oct 2003 09:37:13 -0300
> Saddly the test program has two parameters (threads and loops) threads
> is the number of seperate pthreads to create (which in this case
> includes lua stack/handle creation and loading the lua script bytecode
> into a memory buffer.
It is not enough to "pre-load" your scripts in the C meaning (that
is, to put them in memory). You must pre-load them into Lua. The way
your program is written, you are recompiling the script at each loop
iteration (the call to `lua_dobuffer'). This is a somewhat expensive
operation. You should compile it once (with luaL_loadbuffer) and then
call the result inside the loop.