User talk:BJorsch (WMF)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Performance tests[edit]

I have put some interesting performance tests at my test2 talk to compare your mw.loadData with require when reading data from a large module. My write up is a bit rushed, so it's possible I've blundered somewhere, but loadData appears to be much faster (obviously) when a template is called many times on a page, but is a bit slower when called only 10 times (however, 10 calls takes very little time, so a little bit slower is not an issue). Thanks. Johnuniq (talk) 09:51, 5 March 2013 (UTC)

There is some tradeoff in that accesses to the data loaded by require are slightly faster due to the overhead in the indirection required to make the data read-only for mw.loadData, and the initial load of the data is slower because it runs through the table making sure no unsupported values are returned.
I repeated your 10× tests twenty times each using the API's action=parse&text=.... I got a mean reported "Lua time usage" of 0.0523s for the 10×require test and 0.0465s for the 10×loadData test; the minimum times recorded were 0.038s versus 0.032s, and the maximums were 0.066s versus 0.057s, respectively. That would indicate that loadData is slightly faster in {{convert}} even for only 10 calls per page. The 2× test, on the other hand, did come out slower for loadData. If we want to get a more rigorous analysis, we'd probably need to find someone who actually remembers anything about statistics. BJorsch (WMF) (talk) 14:56, 5 March 2013 (UTC)
Interesting, I'll have to try repeating tests some time. You might have noticed that my tests included the enormous Wiktionary table where the case for mw.loadData is very clear—the benefit is enormous. Johnuniq (talk) 21:01, 5 March 2013 (UTC)


This proposal by jackmcbarn is potentially very useful and seems stalled. Can you help move it along please? Many thanks,  Roger Davies talk 11:49, 18 June 2015 (UTC)

As commented there, it needs unit tests. Anomie 12:39, 18 June 2015 (UTC)