Module talk:Tabular data: Difference between revisions

Content deleted Content added
Search more than 1 column: comment based on some testing
Search more than 1 column: minimal version still has similar times
Line 140:
:::::Oh, I see, you have to pull down the whole table at every call:<pre>local data = args.data or mw.ext.data.get(page)</pre>Yeah, it ain't small (it's at the 2MB limit). What's the alternative; slicing it into a different table for each year? Any batch proc for doing that? — [[User:Guarapiranga|𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]]&nbsp;[[User talk:Guarapiranga|☎]] 07:40, 1 July 2021 (UTC)
:::::: That was a concern for memory usage but I think that is cached. I did a few tests on a blank page and the memory usage didn't increase dramatically when calling the template multiple times. It's clearly processing time which goes up with the number of calls. There is no noticeable difference between Afghanistan and Zambia so the looping is fast (as expected). It's still possible <code>mw.ext.data.get()</code> is responsible, even if not loading each time, as dealing with the cache might take time. It needs some more tests.
::::::: Incidentally your template seems to have considerable overhead, both doubling the time and causing a high expansion depth. Using invoke gets the time down to just over 100ms each call. —&nbsp;<span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;">&nbsp;[[User:Jts1882|Jts1882]]&nbsp;&#124;[[User talk:Jts1882|&nbsp;talk]]&nbsp;</span> 08:00, 1 July 2021 (UTC)
::::::: I've created a function that does the bare minimum (<code>p.lookup2_minimal()</code>, line 208). It doesn't reduce the time substantially (100-150ms depending on run). So I think this sort of template can only be used safely about 50 times on a page.
::::::: For generating tables, the alternative is a module that takes a list of countries like [[Module:Country population]]. A lot more work, but you can get it to do exactly what is needed with appropriate options. —&nbsp;<span style="font-family:Arial;background:#d6ffe6;border:solid 1px;border-radius:5px;box-shadow:darkcyan 0px 1px 1px;">&nbsp;[[User:Jts1882|Jts1882]]&nbsp;&#124;[[User talk:Jts1882|&nbsp;talk]]&nbsp;</span> 09:05, 1 July 2021 (UTC)