Index ResourceLoader dependency lists in startup
authorTrevor Parscal <trevorparscal@gmail.com>
Sat, 25 Oct 2014 00:18:24 +0000 (17:18 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Mon, 8 Dec 2014 19:04:41 +0000 (11:04 -0800)
commitecfdb88dfd63c5700c75b3599aa88ecba5817b12
treefc4c3929ceecb8b1816506cedebc10400988aa6e
parentb87678e380d740550b513a75acc1a5692a52b710
Index ResourceLoader dependency lists in startup

By using the existing indexes of modules in the array being passed to
mw.loader.register we can reduce the size of the startup module by about
6% after gzip (nearly 20% before) on a wiki with very few modules (such
as my localhost). Comparing data from en.wikipedia.org shows about 9%
after gzip (nearly 30% before).

The technique adds a function to mediawiki.js which resolves the indexes
before registering the modules, which costs a little bit of data in that
payload, but it's negligible (118 bytes after gzip) in comparison to the
overall reduction.

Also, cleaned up lies in documentation and strange use of "m" as an
iterator variable.

Bonus: fix ISO8601 timestamp instead of UNIX timestamp being passed
to custom loader scripts.

Change-Id: If12991413fa6129cd20ceab0e59a3a30a4fdf5ce
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderStartUpModule.php
resources/src/mediawiki/mediawiki.js
tests/phpunit/includes/resourceloader/ResourceLoaderStartupModuleTest.php