Skip to content

privatenumber/minification-benchmarks

master
Switch branches/tags
Code

Latest commit

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
cc607d0

Git stats

Files

Permalink
Failed to load latest commit information.

πŸƒβ€β™‚οΈπŸƒβ€β™€οΈπŸƒ JS minification benchmarks

This repo is routinely maintained to compare the quality and speed across the latest versions of the following JavaScript minifiers:

Benchmarks last updated on Aug 13, 2022.

Support this project by ⭐️ starring and sharing it. Follow me to see what other cool projects I'm working on! ❀️

πŸ™‹β€β™‚οΈ Why?

  1. To help you pick a minifier that fits your needs
  2. To promote JS minifiers and document their performances
  3. To encourage healthy competition and improvement amongst minifiers

πŸ‘Ÿ Methodology

  • Each minifier is executed in its own process with a 20 second timeout
  • Artifact integrity is verified by a test before and after minification
  • Minifier upgrade PRs are automated via WhiteSource Renovate
  • Benchmarks are gathered on every PR via GitHub Actions (verifiable minified artifacts are uploaded on each run)

⏱ Metrics

Minifiers are ranked by smallest minzipped size.

Minified size

Size of the minified output.

Minzipped size

Size of the minified output with Gzip compression.

For minifiers, this measures how compressable the output is.

For users, this measures network transfer size, which is usually the metric that matters most.

Time

How long minification took (average of 5 runs). Each time is annotated with a multiplier relative to the fastest minifier.

πŸ“‹ Results

Artifact Original size Gzip size
react v17.0.2 (Source) 72.14 kB 19.41 kB
Minifier Minified size Minzipped size Time
google-closure-compiler -68% 22.83 kB πŸ†-58% 8.17 kB 206x 4,691 ms
uglify-js πŸ†-69% 22.69 kB -58% 8.20 kB 42x 959 ms
swc -68% 22.98 kB -57% 8.26 kB 1x 39 ms
terser -68% 23.12 kB -57% 8.29 kB 20x 474 ms
babel-minify -67% 23.60 kB -57% 8.43 kB 68x 1,555 ms
esbuild -67% 23.70 kB -56% 8.53 kB 1x 36 ms
tdewolff-minify -67% 23.53 kB -56% 8.62 kB πŸ† 23 ms
uglify-js.no-compress -65% 25.03 kB -55% 8.65 kB 7x 180 ms
terser.no-compress -65% 25.08 kB -55% 8.72 kB 9x 217 ms

Artifact Original size Gzip size
moment v2.29.1 (Source) 173.90 kB 36.15 kB
Minifier Minified size Minzipped size Time
uglify-js πŸ†-67% 57.92 kB πŸ†-49% 18.46 kB 77x 2,135 ms
terser -66% 59.06 kB -49% 18.53 kB 45x 1,264 ms
google-closure-compiler -66% 58.27 kB -48% 18.75 kB 198x 5,512 ms
swc -66% 58.86 kB -48% 18.83 kB 2x 83 ms
babel-minify -66% 59.70 kB -47% 19.02 kB 113x 3,141 ms
esbuild -66% 59.83 kB -47% 19.25 kB 1x 43 ms
tdewolff-minify -66% 59.94 kB -46% 19.42 kB πŸ† 28 ms
uglify-js.no-compress -64% 62.50 kB -46% 19.44 kB 13x 385 ms
terser.no-compress -64% 63.15 kB -46% 19.56 kB 19x 538 ms

Artifact Original size Gzip size
jquery v3.5.1 (Source) 287.63 kB 84.37 kB
Minifier Minified size Minzipped size Time
uglify-js πŸ†-69% 88.56 kB πŸ†-63% 30.86 kB 47x 3,012 ms
terser -69% 89.88 kB -63% 30.93 kB 30x 1,931 ms
swc -69% 89.26 kB -63% 30.94 kB 2x 167 ms
tdewolff-minify -69% 89.85 kB -63% 31.44 kB πŸ† 63 ms
uglify-js.no-compress -67% 94.08 kB -63% 31.44 kB 8x 522 ms
terser.no-compress -67% 94.55 kB -63% 31.59 kB 11x 736 ms
babel-minify -68% 92.10 kB -62% 31.75 kB 80x 5,089 ms
esbuild -69% 90.07 kB -62% 31.89 kB 1x 83 ms
google-closure-compiler -68% 92.70 kB -61% 32.98 kB 97x 6,099 ms

Artifact Original size Gzip size
vue v2.6.12 (Source) 342.15 kB 89.52 kB
Minifier Minified size Minzipped size Time
terser -66% 116.77 kB πŸ†-52% 42.83 kB 34x 2,365 ms
uglify-js πŸ†-67% 114.15 kB -52% 42.88 kB 57x 3,917 ms
swc -66% 116.54 kB -52% 42.95 kB 3x 207 ms
babel-minify -66% 117.90 kB -51% 43.83 kB 79x 5,421 ms
google-closure-compiler -66% 115.60 kB -51% 44.05 kB 94x 6,488 ms
esbuild -65% 118.16 kB -51% 44.25 kB 1x 93 ms
uglify-js.no-compress -63% 126.14 kB -50% 44.36 kB 8x 606 ms
tdewolff-minify -66% 117.83 kB -50% 44.37 kB πŸ† 68 ms
terser.no-compress -63% 126.58 kB -50% 44.57 kB 13x 918 ms

Artifact Original size Gzip size
lodash v4.17.21 (Source) 544.10 kB 96.40 kB
Minifier Minified size Minzipped size Time
uglify-js πŸ†-87% 68.51 kB πŸ†-74% 24.59 kB 76x 3,339 ms
google-closure-compiler -86% 73.47 kB -74% 24.84 kB 145x 6,336 ms
terser -87% 71.09 kB -74% 25.06 kB 47x 2,067 ms
swc -87% 70.49 kB -74% 25.30 kB 4x 200 ms
babel-minify -87% 72.37 kB -74% 25.37 kB 102x 4,464 ms
uglify-js.no-compress -86% 74.61 kB -73% 25.76 kB 13x 577 ms
esbuild -87% 72.49 kB -73% 26.06 kB 1x 63 ms
terser.no-compress -86% 75.67 kB -73% 26.10 kB 19x 848 ms
tdewolff-minify -87% 72.47 kB -73% 26.32 kB πŸ† 44 ms

Artifact Original size Gzip size
d3 v6.3.1 (Source) 555.77 kB 129.99 kB
Minifier Minified size Minzipped size Time
uglify-js πŸ†-52% 264.26 kB πŸ†-33% 86.82 kB 72x 7,202 ms
terser -52% 267.99 kB -33% 87.66 kB 52x 5,211 ms
swc -52% 266.20 kB -32% 87.95 kB 5x 566 ms
uglify-js.no-compress -50% 275.35 kB -32% 88.30 kB 12x 1,255 ms
terser.no-compress -50% 276.47 kB -32% 88.99 kB 22x 2,246 ms
tdewolff-minify -51% 269.93 kB -31% 89.70 kB πŸ† 100 ms
esbuild -51% 270.18 kB -30% 90.42 kB 1x 148 ms
google-closure-compiler -51% 270.30 kB -28% 93.48 kB 90x 9,007 ms
babel-minify Failed to minify β€” β€” β€”

Artifact Original size Gzip size
terser v5.14.2 (Source) 955.22 kB 182.84 kB
Minifier Minified size Minzipped size Time
uglify-js -55% 432.81 kB πŸ†-36% 117.92 kB 103x 6,712 ms
terser -54% 438.01 kB -35% 118.00 kB 71x 4,649 ms
terser.no-compress -53% 452.86 kB -35% 118.87 kB 29x 1,882 ms
uglify-js.no-compress -53% 450.63 kB -35% 118.97 kB 18x 1,220 ms
tdewolff-minify -54% 436.31 kB -35% 119.19 kB πŸ† 65 ms
google-closure-compiler πŸ†-56% 420.28 kB -34% 120.24 kB 130x 8,460 ms
esbuild -54% 438.60 kB -34% 120.67 kB 1x 110 ms
swc -49% 483.38 kB -32% 123.50 kB 6x 408 ms
babel-minify Failed to minify β€” β€” β€”

Artifact Original size Gzip size
three v0.124.0 (Source) 1.25 MB 247.75 kB
Minifier Minified size Minzipped size Time
uglify-js πŸ†-48% 642.60 kB πŸ†-36% 158.26 kB 98x 9,454 ms
terser -48% 653.38 kB -36% 158.57 kB 73x 7,056 ms
swc -48% 644.47 kB -36% 158.91 kB 7x 733 ms
google-closure-compiler -48% 644.45 kB -35% 161.84 kB 114x 10,916 ms
uglify-js.no-compress -46% 674.49 kB -35% 162.17 kB 19x 1,855 ms
terser.no-compress -46% 675.60 kB -34% 162.35 kB 30x 2,917 ms
esbuild -48% 646.78 kB -34% 162.65 kB 1x 153 ms
tdewolff-minify -48% 644.89 kB -34% 163.91 kB πŸ† 96 ms
babel-minify Timed out β€” β€” β€”

Artifact Original size Gzip size
victory v35.8.4 (Source) 2.14 MB 309.06 kB
Minifier Minified size Minzipped size Time
uglify-js πŸ†-67% 703.98 kB πŸ†-49% 157.56 kB 75x 11,611 ms
terser -66% 715.74 kB -49% 158.16 kB 63x 9,867 ms
swc -67% 711.97 kB -48% 160.16 kB 6x 1,054 ms
tdewolff-minify -66% 718.74 kB -47% 164.50 kB πŸ† 154 ms
terser.no-compress -64% 759.34 kB -46% 165.72 kB 23x 3,645 ms
uglify-js.no-compress -65% 756.53 kB -46% 166.88 kB 15x 2,345 ms
google-closure-compiler -67% 705.87 kB -44% 174.20 kB 85x 13,146 ms
esbuild -66% 724.21 kB -42% 179.78 kB 1x 244 ms
babel-minify Failed to minify β€” β€” β€”

Artifact Original size Gzip size
echarts v5.1.1 (Source) 3.20 MB 683.47 kB
Minifier Minified size Minzipped size Time
terser πŸ†-69% 1.00 MB πŸ†-53% 321.26 kB 54x 16,215 ms
swc -69% 1.00 MB -53% 323.10 kB 10x 3,232 ms
terser.no-compress -66% 1.07 MB -52% 329.73 kB 23x 7,094 ms
uglify-js.no-compress -67% 1.07 MB -52% 330.46 kB 10x 3,135 ms
esbuild -68% 1.01 MB -52% 330.87 kB 1x 413 ms
tdewolff-minify -68% 1.01 MB -52% 331.30 kB πŸ† 296 ms
babel-minify Timed out β€” β€” β€”
google-closure-compiler Timed out β€” β€” β€”
uglify-js Timed out β€” β€” β€”

Artifact Original size Gzip size
antd v4.16.1 (Source) 6.69 MB 825.74 kB
Minifier Minified size Minzipped size Time
swc πŸ†-66% 2.25 MB πŸ†-44% 460.86 kB 8x 3,205 ms
tdewolff-minify -66% 2.30 MB -43% 473.23 kB πŸ† 385 ms
terser.no-compress -64% 2.43 MB -42% 476.68 kB 20x 7,875 ms
uglify-js.no-compress -64% 2.42 MB -42% 479.73 kB 11x 4,372 ms
esbuild -66% 2.31 MB -41% 488.10 kB 1x 623 ms
babel-minify Timed out β€” β€” β€”
google-closure-compiler Timed out β€” β€” β€”
terser Timed out β€” β€” β€”
uglify-js Timed out β€” β€” β€”

Artifact Original size Gzip size
typescript v4.6.4 (Source) 10.09 MB 1.77 MB
Minifier Minified size Minzipped size Time
uglify-js.no-compress -67% 3.33 MB πŸ†-53% 828.15 kB 9x 8,714 ms
tdewolff-minify πŸ†-69% 3.17 MB -53% 829.76 kB 1x 1,060 ms
terser.no-compress -67% 3.32 MB -53% 831.17 kB 15x 14,355 ms
esbuild -67% 3.28 MB -51% 863.80 kB πŸ† 940 ms
babel-minify Timed out β€” β€” β€”
google-closure-compiler Timed out β€” β€” β€”
swc Invalid output: TypeError β€” β€” β€”
terser Timed out β€” β€” β€”
uglify-js Timed out β€” β€” β€”

Want to see more projects listed? PRs welcome! See the contribution guide for more info.

πŸ₯‡ Results

Best minification performance

UglifyJS takes first place for the smallest uncompressed minified size for all races, and wins 9 out of 11 races for minzipped size! Impressively, it's still written in ES5 but can handle ES6 up to ES2020.

Terser takes a very close second, only short by at most by 1% in minzipped size while performing twice as fast as Uglify! Terser is a fork of UglifyJS and comes with support for ES6+.

Fastest minifier

esbuild runs 10x+ laps around everyone else! The Go-lang JS minifier/bundler is a beast of its own. Not only is it insanely fast, but demonstrates very competitive minification abilities, usually performing closely to Terser while supporting cutting-edge ESNext syntax. However, note that esbuild has a limited set of optimizations and there are currently no plans to improve it.

⚑️ Pro Tip: Harness the speed of esbuild in your Webpack build for minification (and even transpilation) with esbuild-loader.

Definitely keep an eye out for swc, the JS compiler written in Rust. It's also blazing fast and rumor has it they're stepping up their minification.