严格模式是否更具性能? [英] Is strict mode more performant?

查看:104
本文介绍了严格模式是否更具性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在严格模式下在浏览器中执行javascript会使其性能更高吗?是否有任何主流浏览器进行额外优化或使用任何其他技术来提高严格模式下的性能?

Does executing javascript within a browser in 'strict mode' make it more performant, in general? Do any of the major browsers do additional optimisation or use any other techniques that will improve performance in strict mode?

稍微改写一下,是否有其他目标的严格模式,允许浏览器引入额外的优化或其他性能增强?

To rephrase slightly, is strict mode intended, amongst its other goals, to allow browsers to introduce additional optimisations or other performance enhancements?

推荐答案


是否打算采用严格模式,在其他目标中,允许浏览器引入额外的优化或其他性能增强?

Is strict mode intended, amongst its other goals, to allow browsers to introduce additional optimisations or other performance enhancements?

是否意图做到这一点,我不确定,虽然我认为答案是肯定的。

Whether or not it was intended to do this, I'm not sure, although I think the answer is yes.

但我可以肯定地说严格模式确实提供了这些机会,并且浏览器将实施它们 - 无论提供这些机会是否是ECMA委员会的有意目标。但是,我不希望立即采取所有这些机会。在许多情况下,口头禅可能首先是正确性,后来是性能,因为严格模式现在还没有被广泛使用。 (我使用Mozilla的JavaScript引擎并实现了严格模式的各个部分,我们通过这种方式实现它作为一般规则 - 尽管如果我尝试的话我可能会想到一两个例外。)

But I can say with certainty that strict mode does provide these opportunities, and browsers will implement them -- regardless whether providing those opportunities was an intentional goal for the ECMA committee. However, I wouldn't expect all those opportunities to be taken immediately. In many cases the mantra is likely to be correctness first, performance later, because strict mode is not widely used right now. (I work on Mozilla's JavaScript engine and have implemented various parts of strict mode, and we're implementing it this way as a general rule -- although I could probably think of an exception or two if I tried.)

这篇关于严格模式是否更具性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆