Page MenuHomePhabricator

Create Kartographer Lua extension library
Open, LowestPublic

Description

Maps are called usually by the <maplink> and <mapframe> extension tags. In practice these tags are not used directly but are called in Lua scripts as it is done for instance by the module https://en.wikivoyage.org/wiki/Module:Map. Unfortunately the expensive frame:extensionTag(tag, geojson, tagArgs) has to be used to convert the data into an extension tag.

As noted in T189409 calling <maplink> via Lua script can take several hundreds of ms. For example, in https://de.wikivoyage.org/wiki/Halle_%28Saale%29 frame:extensionTag is called about 240 times which takes about 1500 ms.

Therefore, I propose a Scribunto extension library at least with the following functions:

  • mw.kartographer.maplink( args, geoJson )
  • mw.kartographer.mapframe( args, geoJson )

args is an array containing the tag parameters -- same as for the extension tags --, and geoJson is either a JSON array or a JSON-encoded string noted between start and end tag.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 15 2018, 11:34 AM

Example profile data given by @Anomie:

Scribunto_LuaSandboxCallback::callParserFunction		1560 ms	45.1%
Scribunto_LuaSandboxCallback::getEntity		580 ms	16.8%
Scribunto_LuaSandboxCallback::gsub		320 ms	9.2%
Scribunto_LuaSandboxCallback::addStatementUsage		300 ms	8.7%
?		100 ms	2.9%
Scribunto_LuaSandboxCallback::preprocess		100 ms	2.9%
recursiveClone	<mwInit.lua:41>	60 ms	1.7%
Scribunto_LuaSandboxCallback::getExpandedArgument		60 ms	1.7%
Scribunto_LuaSandboxCallback::getFileInfo		40 ms	1.2%
Scribunto_LuaSandboxCallback::fullUrl		40 ms	1.2%
[others]		300 ms	8.7%
Mholloway triaged this task as Lowest priority.
MSantos moved this task from Unsorted to General on the Maps (Kartographer) board.Sep 11 2018, 2:17 PM