Skip to content

πŸƒβ€β™‚οΈπŸƒβ€β™€οΈπŸƒ JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler, tdewolff/minify

License

Notifications You must be signed in to change notification settings

adrianholovaty/minification-benchmarks

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

minification benchmarks

What's the best JavaScript minifier?

This project benchmarks the following minifiers:

Benchmarks last updated on Sep 26, 2024.


πŸ™‹β€β™‚οΈ 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 10s timeout
  • Artifact integrity is verified by a test before and after minification
  • Minifier upgrade PRs are automated via WhiteSource Renovate
  • Benchmarks are updated on every PR via GitHub Actions

⏱ 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

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "react v17.0.2"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11]
	y-axis "Gzip size" 0 --> 19385
	bar [19385,8173,8177,8193,8265,8448,8543,8631,8651,8668,8746,11040]
Loading
Artifact Original size Gzip size
react v17.0.2 (Source) 72.13 kB 19.39 kB
Minifier Minified size Minzipped size Time
1. @swc/core -68% 22.87 kB πŸ†-58% 8.17 kB 8x 20 ms
2. uglify-js πŸ†-69% 22.64 kB -58% 8.18 kB 211x 536 ms
3. google-closure-compiler -68% 22.83 kB -58% 8.19 kB 1291x 3,269 ms
4. terser -68% 23.07 kB -57% 8.27 kB 108x 275 ms
5. babel-minify -67% 23.60 kB -56% 8.45 kB 233x 590 ms
6. esbuild -67% 23.70 kB -56% 8.54 kB 4x 13 ms
7. @tdewolff/minify -67% 23.53 kB -55% 8.63 kB πŸ† 3 ms
8. bun -67% 24.01 kB -55% 8.65 kB 5x 14 ms
9. uglify-js (no compress) -65% 25.03 kB -55% 8.67 kB 37x 95 ms
10. terser (no compress) -65% 25.08 kB -55% 8.75 kB 46x 118 ms
11. tedivm/jshrink -43% 40.82 kB -43% 11.04 kB 41x 105 ms

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "moment v2.29.1"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11]
	y-axis "Gzip size" 0 --> 36231
	bar [36231,18568,18687,18690,18910,19119,19334,19496,19569,19683,19850,24998]
Loading
Artifact Original size Gzip size
moment v2.29.1 (Source) 173.90 kB 36.23 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-67% 57.73 kB πŸ†-49% 18.57 kB 217x 1,181 ms
2. @swc/core -67% 58.21 kB -48% 18.69 kB 9x 51 ms
3. terser -66% 59.14 kB -48% 18.69 kB 124x 675 ms
4. google-closure-compiler -66% 58.27 kB -48% 18.91 kB 711x 3,856 ms
5. babel-minify -66% 59.70 kB -47% 19.12 kB 252x 1,367 ms
6. esbuild -66% 59.82 kB -47% 19.33 kB 3x 18 ms
7. @tdewolff/minify -66% 59.95 kB -46% 19.50 kB πŸ† 5 ms
8. uglify-js (no compress) -64% 62.50 kB -46% 19.57 kB 39x 217 ms
9. terser (no compress) -64% 63.15 kB -46% 19.68 kB 51x 277 ms
10. bun -64% 61.84 kB -45% 19.85 kB 3x 17 ms
11. tedivm/jshrink -44% 97.63 kB -31% 25.00 kB 45x 246 ms

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "jquery v3.5.1"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11]
	y-axis "Gzip size" 0 --> 84498
	bar [84498,30867,30903,30912,31468,31470,31621,31799,31954,32630,33086,40879]
Loading
Artifact Original size Gzip size
jquery v3.5.1 (Source) 287.63 kB 84.50 kB
Minifier Minified size Minzipped size Time
1. @swc/core -69% 89.15 kB πŸ†-63% 30.87 kB 10x 90 ms
2. uglify-js πŸ†-69% 88.45 kB -63% 30.90 kB 192x 1,639 ms
3. terser -69% 89.54 kB -63% 30.91 kB 107x 915 ms
4. @tdewolff/minify -69% 89.85 kB -63% 31.47 kB πŸ† 9 ms
5. uglify-js (no compress) -67% 94.08 kB -63% 31.47 kB 37x 324 ms
6. terser (no compress) -67% 94.55 kB -63% 31.62 kB 42x 362 ms
7. babel-minify -68% 92.10 kB -62% 31.80 kB 264x 2,255 ms
8. esbuild -69% 90.07 kB -62% 31.95 kB 4x 36 ms
9. bun -68% 92.56 kB -61% 32.63 kB 3x 27 ms
10. google-closure-compiler -68% 92.70 kB -61% 33.09 kB 511x 4,363 ms
11. tedivm/jshrink -50% 144.14 kB -52% 40.88 kB 36x 315 ms

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "vue v2.6.12"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11]
	y-axis "Gzip size" 0 --> 89668
	bar [89668,42515,42919,43036,43925,44230,44368,44376,44450,44679,45340,57169]
Loading
Artifact Original size Gzip size
vue v2.6.12 (Source) 342.15 kB 89.67 kB
Minifier Minified size Minzipped size Time
1. @swc/core -66% 115.50 kB πŸ†-53% 42.52 kB 11x 131 ms
2. terser -66% 116.80 kB -52% 42.92 kB 96x 1,123 ms
3. uglify-js πŸ†-67% 113.80 kB -52% 43.04 kB 195x 2,282 ms
4. babel-minify -66% 117.90 kB -51% 43.93 kB 211x 2,476 ms
5. google-closure-compiler -66% 115.61 kB -51% 44.23 kB 403x 4,717 ms
6. esbuild -65% 118.14 kB -51% 44.37 kB 3x 41 ms
7. @tdewolff/minify -66% 117.81 kB -51% 44.38 kB πŸ† 12 ms
8. uglify-js (no compress) -63% 126.14 kB -50% 44.45 kB 32x 375 ms
9. terser (no compress) -63% 126.58 kB -50% 44.68 kB 38x 454 ms
10. bun -64% 121.70 kB -49% 45.34 kB 2x 30 ms
11. tedivm/jshrink -42% 197.36 kB -36% 57.17 kB 35x 416 ms

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "lodash v4.17.21"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10,11]
	y-axis "Gzip size" 0 --> 96690
	bar [96690,24686,24972,25156,25186,25503,25862,26200,26221,26469,26498,36327]
Loading
Artifact Original size Gzip size
lodash v4.17.21 (Source) 544.09 kB 96.69 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-87% 68.17 kB πŸ†-74% 24.69 kB 148x 1,756 ms
2. google-closure-compiler -86% 73.47 kB -74% 24.97 kB 390x 4,633 ms
3. @swc/core -87% 69.84 kB -74% 25.16 kB 9x 113 ms
4. terser -87% 70.67 kB -74% 25.19 kB 81x 961 ms
5. babel-minify -87% 72.37 kB -74% 25.50 kB 163x 1,940 ms
6. uglify-js (no compress) -86% 74.61 kB -73% 25.86 kB 28x 341 ms
7. esbuild -87% 72.48 kB -73% 26.20 kB 2x 29 ms
8. terser (no compress) -86% 75.29 kB -73% 26.22 kB 31x 373 ms
9. bun -86% 74.11 kB -73% 26.47 kB 1x 22 ms
10. @tdewolff/minify -87% 71.90 kB -73% 26.50 kB πŸ† 12 ms
11. tedivm/jshrink -73% 148.78 kB -62% 36.33 kB 27x 328 ms

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "d3 v6.3.1"
	x-axis ["Original",1,2,3,4,5,6,7,8,9]
	y-axis "Gzip size" 0 --> 130686
	bar [130686,87016,87207,88087,88319,89156,89891,90800,92372,94121]
Loading
Artifact Original size Gzip size
d3 v6.3.1 (Source) 555.77 kB 130.69 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-53% 263.56 kB πŸ†-33% 87.02 kB 117x 4,067 ms
2. @swc/core -52% 265.26 kB -33% 87.21 kB 8x 284 ms
3. terser -52% 267.77 kB -33% 88.09 kB 66x 2,279 ms
4. uglify-js (no compress) -50% 275.35 kB -32% 88.32 kB 21x 749 ms
5. terser (no compress) -50% 276.47 kB -32% 89.16 kB 29x 1,025 ms
6. @tdewolff/minify -51% 269.93 kB -31% 89.89 kB πŸ† 35 ms
7. esbuild -51% 270.13 kB -31% 90.80 kB 2x 70 ms
8. bun -51% 273.42 kB -29% 92.37 kB 1x 42 ms
9. google-closure-compiler -51% 270.30 kB -28% 94.12 kB 205x 7,110 ms
10. babel-minify ❌ Minification ❌ ❌ -
11. tedivm/jshrink ❌ Minification ❌ ❌ -

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "terser v5.30.3"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10]
	y-axis "Gzip size" 0 --> 193763
	bar [193763,123089,123334,123482,124428,124609,124897,126562,126706,127547,145178]
Loading
Artifact Original size Gzip size
terser v5.30.3 (Source) 1.01 MB 193.76 kB
Minifier Minified size Minzipped size Time
1. @swc/core -55% 455.61 kB πŸ†-36% 123.09 kB 7x 253 ms
2. uglify-js -55% 451.19 kB -36% 123.33 kB 120x 3,878 ms
3. terser -55% 458.29 kB -36% 123.48 kB 68x 2,198 ms
4. terser (no compress) -53% 474.40 kB -36% 124.43 kB 30x 972 ms
5. uglify-js (no compress) -53% 472.16 kB -36% 124.61 kB 24x 790 ms
6. @tdewolff/minify -55% 456.70 kB -36% 124.90 kB πŸ† 32 ms
7. google-closure-compiler πŸ†-56% 439.95 kB -35% 126.56 kB 205x 6,631 ms
8. esbuild -55% 458.89 kB -35% 126.71 kB 1x 62 ms
9. bun -54% 466.95 kB -34% 127.55 kB 1x 39 ms
10. tedivm/jshrink -37% 633.71 kB -25% 145.18 kB 36x 1,185 ms
11. babel-minify ❌ Minification ❌ ❌ -

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "three v0.124.0"
	x-axis ["Original",1,2,3,4,5,6,7,8,9,10]
	y-axis "Gzip size" 0 --> 248267
	bar [248267,158497,159071,159198,162998,163036,163198,163725,164737,166430,193471]
Loading
Artifact Original size Gzip size
three v0.124.0 (Source) 1.25 MB 248.27 kB
Minifier Minified size Minzipped size Time
1. @swc/core -48% 645.27 kB πŸ†-36% 158.50 kB 8x 398 ms
2. uglify-js πŸ†-49% 641.59 kB -36% 159.07 kB 106x 5,130 ms
3. terser -48% 653.25 kB -36% 159.20 kB 62x 2,994 ms
4. google-closure-compiler -48% 644.45 kB -34% 163.00 kB 170x 8,208 ms
5. uglify-js (no compress) -46% 674.49 kB -34% 163.04 kB 21x 1,015 ms
6. terser (no compress) -46% 675.50 kB -34% 163.20 kB 26x 1,296 ms
7. esbuild -48% 646.76 kB -34% 163.73 kB 1x 91 ms
8. @tdewolff/minify -48% 644.55 kB -34% 164.74 kB πŸ† 48 ms
9. bun -47% 662.49 kB -33% 166.43 kB 1x 49 ms
10. tedivm/jshrink -24% 952.01 kB -22% 193.47 kB 31x 1,519 ms
11. babel-minify ❌ Timed out - - ⚠️ +10,000 ms

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "victory v35.8.4"
	x-axis ["Original",1,2,3,4,5,6,7,8]
	y-axis "Gzip size" 0 --> 309942
	bar [309942,157435,158054,158706,165131,166386,167579,181071,182626]
Loading
Artifact Original size Gzip size
victory v35.8.4 (Source) 2.13 MB 309.94 kB
Minifier Minified size Minzipped size Time
1. uglify-js πŸ†-67% 694.78 kB πŸ†-49% 157.44 kB 111x 6,627 ms
2. @swc/core -67% 712.61 kB -49% 158.05 kB 9x 565 ms
3. terser -66% 715.58 kB -49% 158.71 kB 67x 3,995 ms
4. @tdewolff/minify -66% 718.73 kB -47% 165.13 kB πŸ† 59 ms
5. terser (no compress) -64% 759.34 kB -46% 166.39 kB 27x 1,627 ms
6. uglify-js (no compress) -65% 756.53 kB -46% 167.58 kB 22x 1,345 ms
7. esbuild -66% 724.14 kB -42% 181.07 kB 2x 122 ms
8. bun -66% 727.99 kB -41% 182.63 kB 1x 67 ms
9. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
10. babel-minify ❌ Minification ❌ ❌ -
11. tedivm/jshrink ❌ Post-validation ❌ ❌ -

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "echarts v5.1.1"
	x-axis ["Original",1,2,3,4,5,6,7]
	y-axis "Gzip size" 0 --> 684611
	bar [684611,320265,321987,330736,331412,331563,331791,337695]
Loading
Artifact Original size Gzip size
echarts v5.1.1 (Source) 3.20 MB 684.61 kB
Minifier Minified size Minzipped size Time
1. @swc/core πŸ†-69% 993.25 kB πŸ†-53% 320.27 kB 9x 1,084 ms
2. terser -69% 1.00 MB -53% 321.99 kB 55x 6,045 ms
3. terser (no compress) -66% 1.07 MB -52% 330.74 kB 24x 2,711 ms
4. uglify-js (no compress) -67% 1.07 MB -52% 331.41 kB 16x 1,776 ms
5. esbuild -68% 1.01 MB -52% 331.56 kB 1x 198 ms
6. @tdewolff/minify -68% 1.01 MB -52% 331.79 kB 1x 123 ms
7. bun -68% 1.03 MB -51% 337.70 kB πŸ† 109 ms
8. babel-minify ❌ Timed out - - ⚠️ +10,000 ms
9. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
10. uglify-js ❌ Timed out - - ⚠️ +10,000 ms
11. tedivm/jshrink ❌ Minification ❌ ❌ -

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "antd v4.16.1"
	x-axis ["Original",1,2,3,4,5,6,7]
	y-axis "Gzip size" 0 --> 825175
	bar [825175,454517,457786,472052,475480,478572,488279,491746]
Loading
Artifact Original size Gzip size
antd v4.16.1 (Source) 6.67 MB 825.18 kB
Minifier Minified size Minzipped size Time
1. @swc/core πŸ†-67% 2.18 MB πŸ†-45% 454.52 kB 9x 1,361 ms
2. terser -66% 2.25 MB -45% 457.79 kB 47x 6,905 ms
3. @tdewolff/minify -66% 2.30 MB -43% 472.05 kB 1x 147 ms
4. terser (no compress) -64% 2.43 MB -42% 475.48 kB 21x 3,129 ms
5. uglify-js (no compress) -64% 2.42 MB -42% 478.57 kB 17x 2,504 ms
6. esbuild -65% 2.31 MB -41% 488.28 kB 2x 294 ms
7. bun -66% 2.30 MB -40% 491.75 kB πŸ† 145 ms
8. babel-minify ❌ Timed out - - ⚠️ +10,000 ms
9. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
10. tedivm/jshrink ❌ Timed out - - ⚠️ +10,000 ms
11. uglify-js ❌ Timed out - - ⚠️ +10,000 ms

---
config:
    xyChart:
        width: 720
        height: 360
        xAxis:
            labelPadding: 20
        yAxis:
            labelPadding: 10
---
xychart-beta
	title "typescript v4.9.5"
	x-axis ["Original",1,2,3,4,5]
	y-axis "Gzip size" 0 --> 1884998
	bar [1884998,851746,876535,876658,879301,915495]
Loading
Artifact Original size Gzip size
typescript v4.9.5 (Source) 10.95 MB 1.88 MB
Minifier Minified size Minzipped size Time
1. @swc/core πŸ†-70% 3.31 MB πŸ†-55% 851.75 kB 10x 2,710 ms
2. uglify-js (no compress) -68% 3.54 MB -53% 876.54 kB 14x 3,928 ms
3. @tdewolff/minify -69% 3.36 MB -53% 876.66 kB πŸ† 264 ms
4. terser (no compress) -68% 3.53 MB -53% 879.30 kB 20x 5,303 ms
5. esbuild -68% 3.49 MB -51% 915.50 kB 1x 487 ms
6. terser ❌ Timed out - - ⚠️ +10,000 ms
7. babel-minify ❌ Timed out - - ⚠️ +10,000 ms
8. google-closure-compiler ❌ Timed out - - ⚠️ +10,000 ms
9. uglify-js ❌ Timed out - - ⚠️ +10,000 ms
10. tedivm/jshrink ❌ Minification ❌ ❌ -
11. bun ❌ Post-validation ❌ ❌ -

Sponsors

About

πŸƒβ€β™‚οΈπŸƒβ€β™€οΈπŸƒ JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler, tdewolff/minify

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.5%
  • PHP 0.5%