On Feb 19, 2013 at 9:11 PM, MZMcBride wrote:
I'm guilty of that, and what's been worrying me is that there are
hundreds more units to add. Some guidance on using Lua as a database
would be very desirable.
Quick tests suggest that if {{convert}} is used 100 times on a page
(where that template invokes Module:Convert, which requires
Module:Convertdata), then Convertdata is loaded 100 times. I've
wondered if there might be a pragma in a module like that to set "read
only" (at least a promise of read only, even if it were not enforced),
then more aggressively cache the bytecode so it is loaded once only
per page render, or even once only until the cache memory is flushed.
Or, if performance due to such module abuse is a problem, the data
could be split into, say, ten modules, and the code accessing the data
could work out which of the smaller data modules needed to be
required. I'm not going to worry about that until I have to, but some
guidance would be good.
I just had a quick look at one test page which invokes the module 66
times, and the "NewPP limit report" in the html source says "Lua time
usage: 0.324s" (5 ms/invoke).
http://en.wikipedia.org/wiki/Template:Convert/testcases/bytype/time
Johnuniq