Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

前端项目js压缩成一行性能有很大提升吗?

image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

对 JS 执行性能没有提升。

但因在网络带宽不变的情况下,因为文件变小了,所以下载所需时间就变短了,这对首屏加载速度有一定提升。


补充:因为 AST 中的词法分析是基于字符流的,所以字符长度对于 AST
本身来说有一定影响(主要在内存占用方面),但对于实际的执行效率上是没有影响的。细节见评论区,感谢 @Fractal 的指出。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...