aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorkzc <kzc@users.noreply.github.com>2017-07-02 13:37:04 -0400
committerAlex Lam S.L <alexlamsl@gmail.com>2017-07-03 01:37:04 +0800
commitf3a487a36829eabc7b2d878eba299f7d97d830e0 (patch)
tree1fd590c27fbee6892476b9b691771d1bc0242849 /README.md
parent2dde41615a22ec16b52028a5b09a42b50e4ee094 (diff)
downloadtracifyjs-f3a487a36829eabc7b2d878eba299f7d97d830e0.tar.gz
tracifyjs-f3a487a36829eabc7b2d878eba299f7d97d830e0.zip
document fast mangle-only minify mode (#2194)
Diffstat (limited to 'README.md')
-rw-r--r--README.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md
index c277f653..671d7136 100644
--- a/README.md
+++ b/README.md
@@ -1026,3 +1026,29 @@ in total it's a bit more than just using UglifyJS's own parser.
[acorn]: https://github.com/ternjs/acorn
[sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k
+
+### Uglify Fast Minify Mode
+
+It's not well known, but variable and function name mangling accounts for
+95% of the size reduction in minified code for most javascript - not
+elaborate code transforms. One can simply disable `compress` to speed up
+Uglify builds by 3 to 4 times. In this fast `mangle`-only mode Uglify has
+comparable minify speeds and gzip sizes to
+[`butternut`](https://www.npmjs.com/package/butternut):
+
+| d3.js | minify size | gzip size | minify time (seconds) |
+| --- | ---: | ---: | ---: |
+| original | 451,131 | 108,733 | - |
+| uglify-js@3.0.23 mangle=false, compress=false | 316,600 | 85,245 | 0.73 |
+| uglify-js@3.0.23 mangle=true, compress=false | 220,216 | 72,730 | 1.21 |
+| Butternut 0.4.6 | 217,568 | 72,738 | 1.81 |
+| uglify-js@3.0.23 mangle=true, compress=true | 212,511 | 71,560 | 4.64 |
+
+To enable fast minify mode from the CLI use:
+```
+uglifyjs file.js -m
+```
+To enable fast minify mode with the API use:
+```js
+UglifyJS.minify(code, { compress: false, mangle: true });
+```