lua-users home
lua-l archive

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


On Wed, May 25, 2005 at 03:12:25PM +0500, Zulfiqar Malik wrote:
> Calling this script 10,000 times takes apporx 906ms. However if I
> comment out the last line, then the script will actually be doing
> nothing, but it still takes up 828ms to execute the same number of times
> as before!!! This has led me to believe that the actual code execution
> is pretty fast, whilst the setup (parsing, although I heard that
> theoretically LUA will parse this file/string only once!) is taking all
> the time. Can someone help me get rid of this lag so that I can get on
> making a powerful material system. Lua_dofile is horribly slower so I
> resided to lua_dostring and lua_dobuffer. I have also tried
> pre-compiling the code using luac.exe but with only a slight performance
> gain. 

dofile/dostring will parse the code each time. You need to use
loadfile/loadstring just once, and then call the returned chunk object
10,000 times.

-- Jamie Webb