Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🏃‍♂️🏃‍♀️🏃 JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler, tdewolff/minify

License

NotificationsYou must be signed in to change notification settings

JohnnyFangJr/minification-benchmarks

 
 

Repository files navigation

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

Benchmarks last updated on Jan 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 viaWhiteSource Renovate
  • Benchmarks are gathered on every PR viaGitHub Actions (verifiable minified artifacts are uploaded on each run)

⏱ Metrics

Minifiers are ranked by smallest minifed Brotli size.

Minified size

Size of the minified output.

Minified and Brotli size

Size of the minified output withBrotli 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

ArtifactOriginal sizeGzip size
react v17.0.1 (Source)72.14 kB19.46 kB
MinifierMinified sizeMinzipped sizeTime
google-closure-compiler-68%22.83 kB🏆-58%8.17 kB260x4,848 ms
uglify-js🏆-68%22.80 kB-58%8.21 kB50x940 ms
terser-68%23.12 kB-57%8.29 kB24x455 ms
swc-68%23.10 kB-57%8.33 kB2x48 ms
babel-minify-67%23.53 kB-57%8.38 kB70x1,302 ms
esbuild-67%23.70 kB-56%8.53 kB1x22 ms
uglify-js.no-compress-65%25.06 kB-56%8.65 kB8x167 ms
terser.no-compress-65%25.08 kB-55%8.73 kB11x215 ms
tdewolff-minify-67%23.65 kB-55%8.75 kB🏆19 ms

ArtifactOriginal sizeGzip size
moment v2.29.1 (Source)173.90 kB36.53 kB
MinifierMinified sizeMinzipped sizeTime
uglify-js-66%58.33 kB🏆-49%18.50 kB124x2,255 ms
terser-66%59.06 kB-49%18.59 kB69x1,257 ms
babel-minify-66%59.11 kB-49%18.67 kB171x3,096 ms
google-closure-compiler🏆-66%58.27 kB-49%18.79 kB309x5,589 ms
swc-66%58.98 kB-49%18.79 kB5x103 ms
esbuild-66%59.89 kB-47%19.30 kB1x32 ms
uglify-js.no-compress-64%63.01 kB-47%19.53 kB22x414 ms
terser.no-compress-64%63.15 kB-46%19.60 kB28x512 ms
tdewolff-minify-66%59.95 kB-46%19.67 kB🏆18 ms

ArtifactOriginal sizeGzip size
jquery v3.5.1 (Source)287.63 kB84.73 kB
MinifierMinified sizeMinzipped sizeTime
uglify-js🏆-69%88.82 kB🏆-63%30.97 kB108x3,122 ms
terser-69%89.88 kB-63%31.02 kB56x1,617 ms
swc-69%89.39 kB-63%31.13 kB6x198 ms
uglify-js.no-compress-67%94.26 kB-63%31.58 kB19x559 ms
terser.no-compress-67%94.55 kB-63%31.69 kB22x645 ms
babel-minify-68%91.93 kB-63%31.73 kB174x4,999 ms
esbuild-69%90.20 kB-62%31.98 kB1x52 ms
tdewolff-minify-69%89.93 kB-62%32.16 kB🏆29 ms
google-closure-compiler-68%92.70 kB-61%33.06 kB226x6,491 ms

ArtifactOriginal sizeGzip size
vue v2.6.12 (Source)342.15 kB90.12 kB
MinifierMinified sizeMinzipped sizeTime
uglify-js🏆-66%115.04 kB🏆-53%42.55 kB107x3,931 ms
terser-66%116.77 kB-52%42.91 kB53x1,966 ms
swc-66%116.79 kB-52%43.00 kB8x314 ms
babel-minify-66%117.61 kB-51%43.72 kB153x5,634 ms
google-closure-compiler-66%115.60 kB-51%44.11 kB185x6,814 ms
esbuild-65%118.32 kB-51%44.30 kB1x56 ms
uglify-js.no-compress-63%126.39 kB-51%44.47 kB17x643 ms
terser.no-compress-63%126.58 kB-50%44.64 kB21x799 ms
tdewolff-minify-65%118.17 kB-50%45.10 kB🏆37 ms

ArtifactOriginal sizeGzip size
lodash v4.17.21 (Source)544.10 kB97.26 kB
MinifierMinified sizeMinzipped sizeTime
uglify-js🏆-87%69.66 kB🏆-75%24.57 kB104x3,258 ms
google-closure-compiler-86%73.47 kB-74%24.91 kB212x6,641 ms
babel-minify-87%71.81 kB-74%25.13 kB144x4,504 ms
terser-87%71.09 kB-74%25.16 kB57x1,787 ms
swc-87%70.43 kB-74%25.31 kB8x277 ms
uglify-js.no-compress-86%75.44 kB-73%25.90 kB21x659 ms
esbuild-87%72.49 kB-73%26.14 kB2x65 ms
terser.no-compress-86%75.67 kB-73%26.17 kB23x734 ms
tdewolff-minify-87%72.55 kB-72%26.95 kB🏆31 ms

ArtifactOriginal sizeGzip size
d3 v6.3.1 (Source)555.77 kB130.55 kB
MinifierMinified sizeMinzipped sizeTime
uglify-js🏆-52%265.31 kB🏆-33%87.24 kB107x7,999 ms
terser-52%267.99 kB-33%87.92 kB57x4,252 ms
uglify-js.no-compress-50%276.12 kB-32%88.63 kB17x1,285 ms
terser.no-compress-50%276.47 kB-32%89.16 kB23x1,768 ms
swc-51%270.24 kB-31%90.00 kB16x1,255 ms
esbuild-51%270.20 kB-31%90.63 kB1x110 ms
tdewolff-minify-51%270.08 kB-30%91.16 kB🏆74 ms
google-closure-compiler-51%270.30 kB-28%93.68 kB134x10,030 ms
babel-minifyFailed to minify

ArtifactOriginal sizeGzip size
terser v5.10.0 (Source)905.11 kB181.62 kB
MinifierMinified sizeMinzipped sizeTime
uglify-js-54%412.56 kB🏆-36%116.87 kB87x6,338 ms
terser-54%416.03 kB-36%117.04 kB52x3,748 ms
terser.no-compress-52%430.30 kB-35%117.95 kB22x1,588 ms
uglify-js.no-compress-53%428.78 kB-35%118.07 kB18x1,332 ms
google-closure-compiler🏆-56%398.69 kB-34%119.30 kB126x9,139 ms
tdewolff-minify-54%415.03 kB-34%119.33 kB🏆72 ms
esbuild-54%417.20 kB-34%119.84 kB1x115 ms
babel-minifyFailed to minify
swcInvalid output: TypeError

ArtifactOriginal sizeGzip size
three v0.124.0 (Source)1.25 MB249.01 kB
MinifierMinified sizeMinzipped sizeTime
uglify-js🏆-48%644.18 kB🏆-36%158.60 kB89x10,031 ms
terser-48%653.38 kB-36%159.14 kB47x5,384 ms
swc-48%649.82 kB-36%160.17 kB11x1,257 ms
google-closure-compiler-48%644.45 kB-35%162.42 kB108x12,258 ms
uglify-js.no-compress-46%675.43 kB-35%162.89 kB16x1,914 ms
terser.no-compress-46%675.60 kB-35%162.91 kB20x2,288 ms
esbuild-48%646.99 kB-34%163.24 kB1x224 ms
tdewolff-minify-48%648.26 kB-33%166.78 kB🏆113 ms
babel-minifyTimed out

ArtifactOriginal sizeGzip size
victory v35.8.4 (Source)2.14 MB312.17 kB
MinifierMinified sizeMinzipped sizeTime
terser-66%715.74 kB🏆-49%159.01 kB58x7,452 ms
uglify-js-67%707.08 kB-49%159.14 kB94x12,021 ms
swc-66%715.96 kB-48%161.18 kB12x1,573 ms
terser.no-compress-64%759.34 kB-47%166.63 kB24x3,114 ms
uglify-js.no-compress-65%756.58 kB-46%167.61 kB20x2,578 ms
tdewolff-minify-66%719.75 kB-45%172.08 kB🏆127 ms
google-closure-compiler🏆-67%705.87 kB-44%175.18 kB111x14,160 ms
esbuild-66%724.30 kB-42%180.45 kB1x233 ms
babel-minifyFailed to minify

ArtifactOriginal sizeGzip size
echarts v5.1.1 (Source)3.20 MB689.67 kB
MinifierMinified sizeMinzipped sizeTime
terser🏆-69%1.00 MB🏆-53%322.12 kB34x10,976 ms
terser.no-compress-66%1.07 MB-52%330.73 kB15x5,036 ms
esbuild-68%1.01 MB-52%331.66 kB1x476 ms
uglify-js.no-compress-67%1.07 MB-52%331.66 kB10x3,453 ms
tdewolff-minify-68%1.01 MB-51%339.05 kB🏆319 ms
babel-minifyTimed out
google-closure-compilerTimed out
swcInvalid output: SyntaxError
uglify-jsTimed out

ArtifactOriginal sizeGzip size
antd v4.16.1 (Source)6.69 MB833.49 kB
MinifierMinified sizeMinzipped sizeTime
terser🏆-66%2.25 MB🏆-45%461.42 kB31x12,530 ms
swc-66%2.27 MB-44%463.58 kB13x5,205 ms
terser.no-compress-64%2.43 MB-42%479.86 kB15x6,143 ms
uglify-js.no-compress-64%2.42 MB-42%482.98 kB12x4,850 ms
tdewolff-minify-66%2.30 MB-41%490.51 kB🏆393 ms
esbuild-65%2.31 MB-41%491.09 kB1x692 ms
babel-minifyTimed out
google-closure-compilerTimed out
uglify-jsTimed out

Want to see more projects listed? PRs welcome! See thecontribution 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 runs10x+ 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-edgeESNext syntax. However, note that esbuild has alimited set of optimizations and there are currentlyno plans to improve it.

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

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

About

🏃‍♂️🏃‍♀️🏃 JS minification benchmarks: babel-minify, esbuild, terser, uglify-js, swc, google closure compiler, tdewolff/minify

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript100.0%

[8]ページ先頭

©2009-2025 Movatter.jp