[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: question regarding caching of scripts
- From: Chuck <chucky@...>
- Date: Sat, 20 Mar 2004 13:57:17 +0100
As far as I know, they are no such caching system in Lua for the obvious
reason that it is intended to be a low memory footprint language.
If someone knows there is one, just tell it :)
I think a good way of creating one such system would be to use a ScriptCache
table which would be indexed by the text of the script (lua would
internally use a hash function to create the real index) and whose contents
would be the associated bytecode. The only problem is to determine if the
given script is Lua bytecode or human readable Lua source code.
Then you would want to use the overloading of function which is possible in
lua to replace the old "loadstring" by your new one which calls the former
in case the form has to be precompiled.
I hope this helped.
sohyl siddiqui wrote:
> hi all,
> i have a question regarding script loading. if we send multiple requests
> to lua to execute the same script does it (internally) load and parse the
> script every time. or does it have some kind of caching system so that if
> a request for a previously loaded script is recieved it does load the
> script again. if it does not cache scripts, is there some easy and
> efficient way to implement this? i hope that i have expressed myself
> clearly, thanks in advance, sohyl.
> Do you Yahoo!?
> Yahoo! Finance Tax Center - File online. File on time.