🏃♂️🏃♀️🏃 JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler
/packages/data/data/data.json
Minifiers are ranked by smallest minzipped size.
Size of the minified output.
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.
How long minification took (average of 5 runs). Each time is annotated with a multiplier relative to the fastest minifier.
[!TIP]
What’s the verdict? ⚔️ See the Minifier showdown
---
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,12]
y-axis "Gzip size" 0 --> 19385
bar [19385,8177,8186,8193,8265,8448,8493,8543,8628,8661,8668,8746,11040]
72.13 kB
| 19.39 kB
| |22.64 kB
| 🏆-58% 8.18 kB
| 183x 497 ms
|22.81 kB
| -58% 8.19 kB
| 5x 16 ms
|22.83 kB
| -58% 8.19 kB
| 1135x 3,070 ms
|23.07 kB
| -57% 8.27 kB
| 101x 275 ms
|23.60 kB
| -56% 8.45 kB
| 239x 647 ms
|23.52 kB
| -56% 8.49 kB
| 1x 3 ms
|23.70 kB
| -56% 8.54 kB
| 5x 14 ms
|23.49 kB
| -55% 8.63 kB
| 🏆 3 ms
|23.99 kB
| -55% 8.66 kB
| 5x 14 ms
|25.03 kB
| -55% 8.67 kB
| 33x 91 ms
|25.08 kB
| -55% 8.75 kB
| 43x 118 ms
|40.82 kB
| -43% 11.04 kB
| 45x 123 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,12]
y-axis "Gzip size" 0 --> 36231
bar [36231,18568,18690,18746,18910,19119,19260,19334,19478,19569,19683,19857,24998]
173.90 kB
| 36.23 kB
| |57.73 kB
| 🏆-49% 18.57 kB
| 160x 1,149 ms
|59.14 kB
| -48% 18.69 kB
| 93x 668 ms
|58.43 kB
| -48% 18.75 kB
| 5x 42 ms
|58.27 kB
| -48% 18.91 kB
| 524x 3,753 ms
|59.70 kB
| -47% 19.12 kB
| 204x 1,465 ms
|59.52 kB
| -47% 19.26 kB
| 1x 8 ms
|59.82 kB
| -47% 19.33 kB
| 3x 23 ms
|59.87 kB
| -46% 19.48 kB
| 🏆 7 ms
|62.50 kB
| -46% 19.57 kB
| 29x 215 ms
|63.15 kB
| -46% 19.68 kB
| 37x 270 ms
|61.84 kB
| -45% 19.86 kB
| 2x 20 ms
|97.63 kB
| -31% 25.00 kB
| 39x 282 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,12]
y-axis "Gzip size" 0 --> 84498
bar [84498,30866,30903,30912,30969,31446,31470,31621,31799,31954,32653,33086,40879]
287.63 kB
| 84.50 kB
| |89.17 kB
| 🏆-63% 30.87 kB
| 8x 67 ms
|88.45 kB
| -63% 30.90 kB
| 195x 1,593 ms
|89.54 kB
| -63% 30.91 kB
| 109x 891 ms
|89.33 kB
| -63% 30.97 kB
| 1x 13 ms
|89.68 kB
| -63% 31.45 kB
| 🏆 8 ms
|94.08 kB
| -63% 31.47 kB
| 38x 314 ms
|94.55 kB
| -63% 31.62 kB
| 43x 353 ms
|92.10 kB
| -62% 31.80 kB
| 294x 2,398 ms
|90.07 kB
| -62% 31.95 kB
| 4x 36 ms
|92.55 kB
| -61% 32.65 kB
| 3x 29 ms
|92.70 kB
| -61% 33.09 kB
| 498x 4,056 ms
|144.14 kB
| -52% 40.88 kB
| 44x 363 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,12]
y-axis "Gzip size" 0 --> 89668
bar [89668,42727,42919,43036,43357,43925,44230,44358,44368,44450,44679,45400,57169]
342.15 kB
| 89.67 kB
| |115.70 kB
| 🏆-52% 42.73 kB
| 6x 91 ms
|116.80 kB
| -52% 42.92 kB
| 82x 1,102 ms
|113.80 kB
| -52% 43.04 kB
| 165x 2,206 ms
|117.25 kB
| -52% 43.36 kB
| 1x 16 ms
|117.90 kB
| -51% 43.93 kB
| 202x 2,696 ms
|115.61 kB
| -51% 44.23 kB
| 352x 4,686 ms
|117.69 kB
| -51% 44.36 kB
| 🏆 13 ms
|118.14 kB
| -51% 44.37 kB
| 3x 43 ms
|126.14 kB
| -50% 44.45 kB
| 27x 364 ms
|126.58 kB
| -50% 44.68 kB
| 33x 443 ms
|121.50 kB
| -49% 45.40 kB
| 2x 32 ms
|197.36 kB
| -36% 57.17 kB
| 36x 479 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,12]
y-axis "Gzip size" 0 --> 96690
bar [96690,24686,24972,25186,25240,25503,25862,25979,26200,26221,26498,26655,36327]
544.09 kB
| 96.69 kB
| |68.17 kB
| 🏆-74% 24.69 kB
| 139x 1,689 ms
|73.47 kB
| -74% 24.97 kB
| 363x 4,402 ms
|70.67 kB
| -74% 25.19 kB
| 78x 947 ms
|69.82 kB
| -74% 25.24 kB
| 6x 77 ms
|72.37 kB
| -74% 25.50 kB
| 172x 2,083 ms
|74.61 kB
| -73% 25.86 kB
| 27x 333 ms
|71.38 kB
| -73% 25.98 kB
| 🏆 12 ms
|72.48 kB
| -73% 26.20 kB
| 2x 35 ms
|75.29 kB
| -73% 26.22 kB
| 31x 377 ms
|71.90 kB
| -73% 26.50 kB
| 1x 13 ms
|73.45 kB
| -72% 26.66 kB
| 2x 26 ms
|148.78 kB
| -62% 36.33 kB
| 30x 365 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,10]
y-axis "Gzip size" 0 --> 130686
bar [130686,87016,87205,88087,88148,88319,89156,89882,90800,92395,94121]
555.77 kB
| 130.69 kB
| |263.56 kB
| 🏆-33% 87.02 kB
| 113x 3,927 ms
|265.22 kB
| -33% 87.21 kB
| 5x 198 ms
|267.77 kB
| -33% 88.09 kB
| 65x 2,274 ms
|270.83 kB
| -33% 88.15 kB
| 1x 37 ms
|275.35 kB
| -32% 88.32 kB
| 20x 711 ms
|276.47 kB
| -32% 89.16 kB
| 29x 1,011 ms
|269.35 kB
| -31% 89.88 kB
| 🏆 35 ms
|270.13 kB
| -31% 90.80 kB
| 1x 69 ms
|273.41 kB
| -29% 92.40 kB
| 1x 49 ms
|270.30 kB
| -28% 94.12 kB
| 204x 7,048 ms
|
---
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,11]
y-axis "Gzip size" 0 --> 193763
bar [193763,122353,123291,123334,123482,124428,124609,124885,126562,126707,127653,145178]
1.01 MB
| 193.76 kB
| |440.17 kB
| 🏆-37% 122.35 kB
| 1x 38 ms
|455.63 kB
| -36% 123.29 kB
| 5x 174 ms
|451.19 kB
| -36% 123.33 kB
| 110x 3,787 ms
|458.29 kB
| -36% 123.48 kB
| 63x 2,172 ms
|474.40 kB
| -36% 124.43 kB
| 28x 967 ms
|472.16 kB
| -36% 124.61 kB
| 22x 778 ms
|456.59 kB
| -36% 124.89 kB
| 🏆 34 ms
|439.95 kB
| -35% 126.56 kB
| 192x 6,579 ms
|458.89 kB
| -35% 126.71 kB
| 1x 63 ms
|466.80 kB
| -34% 127.65 kB
| 1x 44 ms
|633.71 kB
| -25% 145.18 kB
| 39x 1,341 ms
|
---
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,11]
y-axis "Gzip size" 0 --> 248267
bar [248267,158764,159071,159198,160827,162998,163036,163198,163725,164610,166210,193471]
1.25 MB
| 248.27 kB
| |643.05 kB
| 🏆-36% 158.76 kB
| 5x 298 ms
|641.59 kB
| -36% 159.07 kB
| 98x 5,046 ms
|653.25 kB
| -36% 159.20 kB
| 57x 2,934 ms
|647.00 kB
| -35% 160.83 kB
| 1x 56 ms
|644.45 kB
| -34% 163.00 kB
| 167x 8,569 ms
|674.49 kB
| -34% 163.04 kB
| 19x 994 ms
|675.50 kB
| -34% 163.20 kB
| 25x 1,287 ms
|646.76 kB
| -34% 163.73 kB
| 1x 91 ms
|642.46 kB
| -34% 164.61 kB
| 🏆 51 ms
|655.93 kB
| -33% 166.21 kB
| 1x 56 ms
|952.01 kB
| -22% 193.47 kB
| 33x 1,715 ms
|+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,9]
y-axis "Gzip size" 0 --> 309942
bar [309942,157435,157843,158706,162248,165014,166386,167579,181071,182671]
2.13 MB
| 309.94 kB
| |694.78 kB
| 🏆-49% 157.44 kB
| 116x 6,579 ms
|706.21 kB
| -49% 157.84 kB
| 7x 435 ms
|715.58 kB
| -49% 158.71 kB
| 70x 3,977 ms
|716.13 kB
| -48% 162.25 kB
| 1x 84 ms
|717.07 kB
| -47% 165.01 kB
| 🏆 57 ms
|759.34 kB
| -46% 166.39 kB
| 28x 1,606 ms
|756.53 kB
| -46% 167.58 kB
| 23x 1,314 ms
|724.14 kB
| -42% 181.07 kB
| 2x 125 ms
|727.90 kB
| -41% 182.67 kB
| 1x 81 ms
|+10,000 ms
|
---
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,8]
y-axis "Gzip size" 0 --> 684611
bar [684611,321255,321987,324608,330736,331412,331563,331847,337934]
3.20 MB
| 684.61 kB
| |994.54 kB
| 🏆-53% 321.26 kB
| 6x 822 ms
|1.00 MB
| -53% 321.99 kB
| 50x 6,005 ms
|1.01 MB
| -53% 324.61 kB
| 1x 165 ms
|1.07 MB
| -52% 330.74 kB
| 22x 2,649 ms
|1.07 MB
| -52% 331.41 kB
| 14x 1,756 ms
|1.01 MB
| -52% 331.56 kB
| 1x 192 ms
|1.01 MB
| -52% 331.85 kB
| 🏆 119 ms
|1.02 MB
| -51% 337.93 kB
| 1x 128 ms
|+10,000 ms
|+10,000 ms
|+10,000 ms
|
---
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,8]
y-axis "Gzip size" 0 --> 825175
bar [825175,452477,457786,463332,471791,475480,478572,488279,491833]
6.67 MB
| 825.18 kB
| |2.15 MB
| 🏆-45% 452.48 kB
| 9x 1,270 ms
|2.25 MB
| -45% 457.79 kB
| 48x 6,823 ms
|2.28 MB
| -44% 463.33 kB
| 1x 214 ms
|2.29 MB
| -43% 471.79 kB
| 🏆 141 ms
|2.43 MB
| -42% 475.48 kB
| 22x 3,111 ms
|2.42 MB
| -42% 478.57 kB
| 17x 2,525 ms
|2.31 MB
| -41% 488.28 kB
| 2x 304 ms
|2.30 MB
| -40% 491.83 kB
| 1x 177 ms
|+10,000 ms
|+10,000 ms
|+10,000 ms
|+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,6]
y-axis "Gzip size" 0 --> 1884998
bar [1884998,859199,860657,875817,876535,879301,915551]
Artifact | Original size | Gzip size | |
---|---|---|---|
typescript v4.9.5 (typescript@4.9.5/lib/typescript.js">Source) | 10.95 MB |
1.88 MB |
|
Minifier | Minified size | Minzipped size | Time |
1. @swc/core | 🏆-70% 3.31 MB |
🏆-54% 859.20 kB |
8x 2,177 ms |
2. oxc-minify | -69% 3.35 MB |
-54% 860.66 kB |
1x 423 ms |
3. @tdewolff/minify | -69% 3.35 MB |
-54% 875.82 kB |
🏆 264 ms |
4. uglify-js (no compress) | -68% 3.54 MB |
-53% 876.54 kB |
15x 4,029 ms |
5. terser (no compress) | -68% 3.53 MB |
-53% 879.30 kB |
20x 5,318 ms |
6. esbuild | -68% 3.49 MB |
-51% 915.55 kB |
1x 490 ms |
7. terser ❌ Timed out | - | - | ![]() +10,000 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 ❌ Timed out | - | - | ![]() +10,000 ms |
12. bun ❌ Post-validation | ❌ | ❌ | - |
[!NOTE]
🤖 This analysis is AI generated
Woah, what a race! It’s been an electric showdown between the heavy hitters in the realm of JavaScript minifiers. With compression rates and processing speeds on the line, it’s time to crown the victor and analyze the knockouts. Without further ado, let’s dive into the results.
💥 @swc/core takes the crown for the average user! Balancing impeccable compression ratios and breathtaking speed, SWC repeatedly came out near the top. While it didn’t win every round, its performance was dazzling, especially for larger files like antd
and typescript
. For instance, it flattened the enormous 1.88 MB typescript
package to 859.20 kB (46%) in just 2,177 ms, a brilliant feat. This suggests SWC consistently delivers fantastic results with both small and massive files. It’s the minifier to bet on for those looking for reliable compression and swift execution.
Ugly-yet-effective Production Workhorse: uglify-js
Despite its cranky processing times that bordered on a timeout in some rounds (hello, antd
!), uglify-js was an absolute champion at squeezing the smallest possible size for multiple files. Take the lodash
package: 24.69 kB (26%) in 1,689 ms—a clear finish over the competition. For those willing to trade time for size dedication, uglify-js is your faithful servant.
Young and Speedy: oxc-minify
Coming in hot, oxc-minify performed blisteringly fast in nearly every round while keeping size reductions respectable. It sped through lodash
in 12 ms and terser
in 38 ms but without quite achieving the size reductions of uglify or SWC. Nonetheless, it’s the sprinter of this competition, excelling at zipping through your code with fantastic efficiency.
Tactical Leader: @tdewolff/minify
If raw speed is your only metric, @tdewolff/minify will dazzle you! For example, it demolished three
in just 51 ms (though it was a bit chunkier at 164.61 kB compared to SWC’s 158.76 kB). Super-slick for real-time pipelines where execution time takes precedence over file size.
esbuild
A solid performer among the compact-size group, esbuild offers speedy reductions but doesn’t punch the same weight as top-notch minifiers above. However, with its simple API and competitive processing of smaller packages, it’s worth considering for light workloads.
babel-minify: Unfortunately, this minifier tripped on d3
due to a runtime error, thus crashing out of our competition. Proceed with caution—its development seems stagnant compared to its competitors. Not for the faint of heart!
tedivm/jshrink: Ouch! An unclosed regex pattern on d3
made this minifier wave the white flag. While not necessarily a lightweight entrant, reliability issues keep it from competing seriously.
bun: This up-and-comer couldn’t hold up to the rigors of JS minification, failing the post-validation stage on typescript
. Definitely unstable for production use right now.
Wow, what an exhilarating display of compression power and speed finesse! While @swc/core emerges as the undeniable superstar of this tournament with its consistent all-around performance, our honorable mentions prove that there’s more than one path to minification glory. Huge respect to all participants for putting up an impressive fight—their efforts will leave JavaScript developers spoiled for choice. Stay tuned for the next championship!