Requests for comment/Minifier

This RFC aims to improve the minification ratio of MediaWiki's JavaScript resources.

Proposal
Our current minification library, JavaScriptMinifier is actually quite nice, as it combines a decent minification ratio with a very good performance, however we can do better, and two areas are especially important: mobile where every byte counts and VisualEditor which delivers a load of scripts.

I propose to replace standard minification with an UglifyJS based service on WMF.

Comparison of minification

 * All sizes are in kilobytes

Proof of concept
Code lives in Extension:Minifier and requires a core change to work.

Technical obstacles
UglifyJS is slower than JavaScriptMinifier so some measures might be needed to improve cache hit rate:
 * Minifier server already has a cache shared between all wikis.
 * Make memcached keys global?
 * Minify every module separately to avoid minifying all possible combinations of modules?
 * Minify only module JS without messages to avoid cache invalidation upon localisation changes?