Page MenuHomePhabricator

Globally track Scribunto LuaSandbox profiling data
Closed, DuplicatePublic

Description

Currently Scribunto creates profiling data on page parses, that is included in the html source code (see below for an excerpt). Working on the performance of the Wikibase Lua components, it would be helpful if we collected (in Graphite, so that we can create a nice Grafana dashboard) this data.

In more concrete terms, it would be nice to have a whitelist of functions to track, for which we will track how much time is spent in them globally (and maybe how often they're called). On top of that, we should collect the overall runtime of all Lua code (so that we have a reference metric, to set the per-function data in context). With that we could adequately measure the impact of Scribunto related changes.

Lua time usage: 6.217/10.000 seconds
Lua memory usage: 11.68 MB/50 MB
Lua Profile:
    Scribunto_LuaSandboxCallback::callParserFunction                2840 ms       46.1%
    Scribunto_LuaSandboxCallback::getEntity                          900 ms       14.6%
    Scribunto_LuaSandboxCallback::addStatementUsage                  700 ms       11.4%
    Scribunto_LuaSandboxCallback::getEntityStatements                320 ms        5.2%
    Scribunto_LuaSandboxCallback::gsub                               220 ms        3.6%
    init <Modul:Languages>                                           120 ms        1.9%
    recursiveClone <mwInit.lua:41>                                   120 ms        1.9%
    Scribunto_LuaSandboxCallback::getAllExpandedArguments            100 ms        1.6%
    Scribunto_LuaSandboxCallback::incrementStatsKey                   80 ms        1.3%
    getExpandedArgument <mw.lua:165>                                  60 ms        1.0%
    [others]