resourceloader: Reduce width of module hash from 7 chars to 5
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 29 Jul 2019 16:15:23 +0000 (17:15 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 2 Sep 2019 01:25:48 +0000 (01:25 +0000)
commit9f516f1d3b6ab6a4f1bb7e385c93e4d9bccb46d7
tree8b00f369d83a8f5629ef4f9dcc50b1ab2b80dda9
parentd0dc2d2598fb7044ad49283d9574d61c80441cea
resourceloader: Reduce width of module hash from 7 chars to 5

In a nut shell:

* We very often (52% of modules on enwiki) pad the hash with a zero,
  which means the amount of bits we currently compute already fit in
  6 characters already for most modules. For some modules (3%) we
  even padded two zeroes.

* For the (now documented) use cases, the space of 78 Giga
  (78 billion, or 78 milliard) seems more than we need. The space of
  60 million should be enough.

  This follows-up dfd046412f from 2016, which previously shortened the hash
  down from 8 chars of base 64 (or 12 chars of hex) to 7 chars of base 32.
  Before that change, the space was 281 Tera (64^8, or 16^12).

For more details see the added inline comment for ResourceLoader::makeHash,
and also the data at <https://phabricator.wikimedia.org/T229245>.

Bug: T229245
Change-Id: I9ad11772a33b3a44cb625275b1d7353e1393ee49
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderStartUpModule.php
resources/src/startup/mediawiki.js
tests/phpunit/ResourceLoaderTestCase.php
tests/phpunit/includes/OutputPageTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderStartUpModuleTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js