JS 打包压缩工具测试(benckmarks)

本贴最后更新于 413 天前,其中的信息可能已经时移世异

JS 打包压缩工具测试(benckmarks)

测试工具


测试对比的工具如下:

结果


code: https://github.com/privatenumber/minification-benchmarks

标识:

  • Ms:🐇 最快 🐢 最慢
  • Size:🐥 最轻 🐷 最重
  • Gzip:🐥 最轻 🐷 最重

d3/dist/d3

Minifier Size Gzip size Time
babel-minify - default 🐥240.19 KB (47%) 80.38 KB (67%) 🐢6085.35ms
esbuild 245.26 KB (48%) 🐷82.26 KB (69%) 🐇90.09ms
terser - default 242.96 KB (48%) 79.76 KB (67%) 2000.89ms
terser - no compress 🐷249.9 KB (49%) 80.89 KB (68%) 822.62ms
uglify-js - default 241.43 KB (47%) 🐥79.21 KB (66%) 3164.75ms
uglify-js - no compress 249.56 KB (49%) 80.29 KB (67%) 546.85ms

jquery

Minifier Size Gzip size Time
babel-minify - default 90.23 KB (32%) 31.19 KB (37%) 🐢1982.22ms
esbuild 88.51 KB (31%) 🐷31.42 KB (37%) 🐇26.98ms
terser - default 88.23 KB (31%) 30.49 KB (36%) 672.87ms
terser - no compress 🐷92.79 KB (33%) 31.15 KB (37%) 253.71ms
uglify-js - default 🐥87.05 KB (30%) 🐥30.29 KB (36%) 997.04ms
uglify-js - no compress 92.05 KB (32%) 30.84 KB (37%) 185.19ms

lodash

Minifier Size Gzip size Time
babel-minify - default 70.25 KB (13%) 24.66 KB (26%) 🐢1511.54ms
esbuild 70.22 KB (13%) 🐷25.73 KB (27%) 🐇28.61ms
terser - default 69.54 KB (13%) 24.64 KB (26%) 665.08ms
terser - no compress 🐷74.01 KB (13%) 25.64 KB (27%) 272.37ms
uglify-js - default 🐥68.31 KB (12%) 🐥24.05 KB (25%) 952.09ms
uglify-js - no compress 73.46 KB (13%) 25.2 KB (26%) 180.04ms

moment

Minifier Size Gzip size Time
babel-minify - default 57.87 KB (34%) 18.34 KB (51%) 🐢1053.66ms
esbuild 58.74 KB (34%) 18.96 KB (53%) 🐇18.22ms
terser - default 57.84 KB (34%) 18.27 KB (51%) 429.16ms
terser - no compress 🐷61.82 KB (36%) 🐷19.26 KB (53%) 148.60ms
uglify-js - default 🐥57.43 KB (33%) 🐥18.16 KB (50%) 562.93ms
uglify-js - no compress 61.54 KB (36%) 19.1 KB (53%) 109.82ms

react/cjs/react.development.js

Minifier Size Gzip size Time
babel-minify - default 19.4 KB (32%) 7.03 KB (43%) 🐢252.43ms
esbuild 19.65 KB (33%) 7.18 KB (44%) 🐇10.73ms
terser - default 19.12 KB (32%) 6.97 KB (43%) 140.19ms
terser - no compress 🐷20.71 KB (34%) 🐷7.34 KB (45%) 44.38ms
uglify-js - default 🐥18.7 KB (31%) 🐥6.83 KB (42%) 188.36ms
uglify-js - no compress 20.46 KB (34%) 7.15 KB (44%) 28.62ms

terser

Minifier Size Gzip size Time
babel-minify - default ⚠️ Failed ⚠️ Failed ⚠️ Failed
esbuild 398.14 KB (47%) 🐷114.27 KB (68%) 🐇57.59ms
terser - default 🐥396.16 KB (47%) 🐥111.45 KB (66%) 🐢1650.03ms
terser - no compress 🐷409.27 KB (49%) 112.18 KB (66%) 676.80ms
uglify-js - default ⚠️ Failed ⚠️ Failed ⚠️ Failed
uglify-js - no compress ⚠️ Failed ⚠️ Failed ⚠️ Failed

vue/dist/vue.runtime.common.dev

Minifier Size Gzip size Time
babel-minify - default 93.04 KB (42%) 30.78 KB (50%) 🐢1187.67ms
esbuild 93.13 KB (42%) 31.11 KB (51%) 🐇24.62ms
terser - default 92.77 KB (42%) 30.6 KB (50%) 429.44ms
terser - no compress 🐷98.89 KB (45%) 31.4 KB (51%) 236.71ms
uglify-js - default 🐥92.2 KB (42%) 🐥30.58 KB (50%) 771.42ms
uglify-js - no compress

分析


  • 前端

    前端技术一般分为前端设计和前端开发,前端设计可以理解为网站的视觉设计,前端开发则是网站的前台代码实现,包括 HTML、CSS 以及 JavaScript 等。

    242 引用 • 1345 回帖
  • JavaScript

    JavaScript 一种动态类型、弱类型、基于原型的直译式脚本语言,内置支持类型。它的解释器被称为 JavaScript 引擎,为浏览器的一部分,广泛用于客户端的脚本语言,最早是在 HTML 网页上使用,用来给 HTML 网页增加动态功能。

    694 引用 • 1142 回帖 • 613 关注
  • 打包
    5 引用 • 8 回帖
  • 分享

    有什么新发现就分享给大家吧!

    233 引用 • 1671 回帖 • 52 关注

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...