lua-users home
lua-l archive

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


We use lua in some application but gc cycle was a problem for only one, in it we use lua for data base handling because we don't have space for a big classical database manager, we only have static table a need to make query in it. The data base was stored in very huge lua table (75000 item last time I see it) with a lot of string and user data. Theses table need a lot of time for gc traversal and because it was modified very often, most of time this time was lose. I've modified the lua gc to allow definition of _const_ object and with a garbage function that allow traversal of a table at any time. So we use const tables and functions and each time we have enought time we start garbage the table and collect the little amount of dead object in it. Without this patch a gc cycle take 17 second in worst case with it it take less than 1 second. This app work under a little embeded system with slow memory so traversal of all lua object was slow (it was also why we have choose lua, ie hash lookup need a small look in memory).

But this sample was very specific and probably a unique case, this patch was very usefull for this app but I've never used it for other application because of small difference in classical code.


--
Thomas Lavergne                       "Le vrai rêveur est celui qui rêve
                                       de l'impossible."  (Elsa Triolet)
thomas.lavergne@laposte.net
d-12@laposte.net    ICQ:#137121910     http://assoc.wanadoo.fr/thallium/