[Pkg-javascript-commits] [uglifyjs] 173/491: document fast mangle-only minify mode (#2194)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:32 UTC 2018
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.
commit f3a487a36829eabc7b2d878eba299f7d97d830e0
Author: kzc <kzc at users.noreply.github.com>
Date: Sun Jul 2 13:37:04 2017 -0400
document fast mangle-only minify mode (#2194)
---
README.md | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/README.md b/README.md
index c277f65..671d713 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 at 3.0.23 mangle=false, compress=false | 316,600 | 85,245 | 0.73 |
+| uglify-js at 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 at 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 });
+```
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list