Template talk:Find sources AFD

Latest comment: 10 years ago by Mr. Stradivarius in topic Lua version

JSTOR

edit

I recommend removing "JSTOR" from the list of sources, as google scholar indexes jstor and some categories of afd subjects are largely not included by JSTOR (their archives contain relatively few journals in the physical sciences). Protonk (talk) 17:28, 20 September 2014 (UTC)Reply

Lua version

edit

@Fram: I've converted this to Lua, using Module:Find sources. There's a demonstration at Template:Find sources AFD/sandbox - what do you think? — Mr. Stradivarius ♪ talk ♪ 15:51, 29 September 2014 (UTC)Reply

I don't know a lot about Lua, and can't accurately judge it. The end result looks the same, so if it is using less template invocations, or the same number but more efficiently somehow, then I have no objection against your version. If it would be more likely to trigger the transclusion limit though (the reason this template fork was created), then I obviously oppose this ;-) Fram (talk) 15:54, 29 September 2014 (UTC)Reply
@Fram: Yes, it is using less template invocations. I've written the module so that the only template invocation used is the call to #invoke on the template page (though technically that's a parser function, not a template). After control is passed over to Lua the code doesn't add to the template limits at all - instead, Lua has its own memory limit and CPU time limit. (It is possible to increase the expensive parser function count from Lua, but this module doesn't do that.) The great thing about using Lua here is that the template configuration can be moved inside the module, so the only parameters we need to load from wikitext are the search terms themselves. And for the search terms, from Lua we only load them once, and we only load as many of them as were specified. Contrast this with the current template, where you have to load all five parameters for all six search engines. I just did a test in my sandbox with 1000 transclusions, and with the current template, the page took 4.619 seconds to load, with a post-expand include size of 1858000/2048000 bytes, and a highest transclusion depth of 8. With the sandbox version, it was 2.722 seconds, 1076000/2048000 bytes, and a highest transclusion depth of 2. For the sandbox, the Lua time usage was 1.696/10.000 seconds, and the memory usage was 2.12 MB/50 MB, so still a lot of room. I managed to get 1903 transclusions of the sandbox before I went over the post-expand include size limit. — Mr. Stradivarius ♪ talk ♪ 16:21, 29 September 2014 (UTC)Reply
And if we ever get more than 1903 AfD's in one day, then there are more urgent problems than the transclusion limit :-) Thanks, great work, feel free to replace my version with yours of course. Fram (talk) 19:24, 29 September 2014 (UTC)Reply
+1 Protonk (talk) 16:43, 29 September 2014 (UTC)Reply
I've switched the template over to the Lua version. Let me know if you spot any issues. — Mr. Stradivarius ♪ talk ♪ 23:36, 29 September 2014 (UTC)Reply