问题描述
我知道一个 UglifyJS 来缩小他们的源代码.在他们的构建脚本中,他们具体设置 max_line_length
指令为 32 * 1024
:
UglifyJS 的文档 在 max-line-len
指令;
--max-line-len
(默认 32K 个字符)——在大约 32K 个字符后添加一个换行符.当所有代码都在大约 670K 的一行上时,我已经看到 FF 和 Chrome 发出嘶嘶声.通过 –max-line-len 0 禁用此安全功能.
I know about a similar question but it is a tiny bit off from what I am asking here, so please don't flag
it as a duplicate.
When you see the production version of jQuery, why is there a newline after a while? I downloaded a copy and deleted all the newlines (apart from the licence) and it still worked. (I ran the entire unit test suite against my changes on Mozilla Firefox, Google Chrome and Opera.)
I know three newlines (not counting the license) is not going to slow it down a lot, but still, doesn't every tiny bit help?
I have assigned myself a small challenge, to squeeze every little bit of performance out of my JavaScript code.
jQuery currently use UglifyJS to minify their source code. In their build script, they specifically set the max_line_length
directive to be 32 * 1024
:
The documentation for UglifyJS has this to say on the max-line-len
directive;
这篇关于为什么我们在缩小的 JavaScript 中有换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!