gpt4 book ai didi

javascript - Closure compiler advanced - 任何性能影响?

转载 作者:行者123 更新时间:2023-11-29 15:04:33 24 4
gpt4 key购买 nike

在线闭包编译器很棒:

http://closure-compiler.appspot.com/home

但是,当使用高级选项时,它会完全影响脚本的性能吗? IE,一般来说它会变快还是变慢,还是取决于脚本本身?或者根本没有性能影响?

我问这个是因为我写的一些脚本对性能很关键,我知道这个问题的答案是“试试看”,但我不太擅长运行这类测试,我不知道从哪里开始。

最佳答案

这是来自 Closure Compilier faq 的两点您可能会感兴趣。

Does the compiler make any trade-off between my application's execution speed and download code size?

Yes. Any optimizing compiler makes trade-offs. Some size optimizations do introduce small speed overheads. However, the Closure Compiler's developers have been careful not to introduce significant additional runtime. Some of the compiler's optimizations even decrease runtime (see next question).

Does the compiler optimize for speed?

In most cases smaller code is faster code, since download time is usually the most important speed factor in web applications. Optimizations that reduce redundancies speed up the run time of code as well.

所以这似乎取决于您编写的代码。可能会更快,但也有可能会慢一点。最终,将需要进行测试。

关于javascript - Closure compiler advanced - 任何性能影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5017797/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com