resourceloader: Implement mw.inspect 'time' report
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 10 Jul 2018 00:28:55 +0000 (17:28 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Thu, 23 Aug 2018 17:54:55 +0000 (10:54 -0700)
commit7f3c102a3bcbc1a8c6576a1bebf3bfd3c5053200
treea94bd7c02dbad439f3755114542a234b6e2e1a66
parentec88ffd230b71075f520ebd6567fcf9d1a8fa1fa
resourceloader: Implement mw.inspect 'time' report

When enabling $wgResourceLoaderEnableJSProfiler, mw.loader gets instrumented
with the following timing values for each of the modules loaded on the page:

* 'total' - This measures the time spent in mw.loader#execute(), and
  represents the initialisation of the module's implementation, including
  the registration of messages, templates, and the execution of the 'script'
  closure received from load.php.

* 'script' – This measures only the subset of time spent in the internal
  runScript() function, and represents just the execution of the module's
  JavaScript code as received through mw.loader.implement() from load.php.

  For user scripts and site scripts, this measures the call to domEval
  (formerly known as "globalEval").

* 'execute' - This measures the self time of mw.loader#execute(), which is
  effectively `total - script`.

To view the report, enable the feature, then run `mw.inspect( 'time' )` from
the browser console, which will render a table with the initialisation
overhead from each module used on the page.

Bug: T133646
Change-Id: I68d1193b62c93c97cf09b7d344c896afb437c5ac
includes/DefaultSettings.php
includes/resourceloader/ResourceLoaderStartUpModule.php
maintenance/jsduck/categories.json
resources/src/mediawiki.inspect.js
resources/src/startup/mediawiki.js
resources/src/startup/profiler.js [new file with mode: 0644]