From the Lua profile of https://de.wikivoyage.org/wiki/Halle_(Saale) (see html source code):
Lua Profile:
Scribunto_LuaSandboxCallback::callParserFunction 1960 ms 45.6%
Scribunto_LuaSandboxCallback::getEntity 600 ms 14.0%
Scribunto_LuaSandboxCallback::addStatementUsage 540 ms 12.6%
Scribunto_LuaSandboxCallback::gsub 280 ms 6.5%
Scribunto_LuaSandboxCallback::getEntityStatements 200 ms 4.7%
Scribunto_LuaSandboxCallback::addSiteLinksUsage 120 ms 2.8%
? 100 ms 2.3%
Scribunto_LuaSandboxCallback::incrementStatsKey 80 ms 1.9%
init <Modul:CountryData/Geography> 60 ms 1.4%
recursiveClone <mwInit.lua:41> 40 ms 0.9%
[others] 320 ms 7.4%On top of "the usual suspects" like getEntity (which are expected to be heavy, given they load the actual entities), addStatementUsage also seems to be fairly expensive.
Things to consider:
- Only calling addStatementUsage once for each statement (cache in mw.wikibase.entity) IMPORTANT : Make sure the cache is not shared between titles/ parser runs)
- Make the PHP implementation faster: Don't update the ParserOutput's extension data unless absolutely needed (not sure this saves enough)