Does JavaScript (ECMAScript5) Strict Mode offer significant performance advantages to merit widespread use?

后端 未结 3 619
一个人的身影
一个人的身影 2021-02-07 20:07

I\'m reading up a bit on using Strict Mode for JavaScript and it seems that, generally speaking, the idea is to force a more rigid set of rules onto the coder to ensure that the

3条回答
  •  天涯浪人
    2021-02-07 20:41

    Well, strict mode code can certainly perform better because it removes issues that made optimization harder, for example, from the top of my head:

    • The with statement was removed (Really difficult -if not impossible- to optimize).
    • No more undeclared assignments, and other prohibitions, e.g. (delete varName;)
    • eval does not introduce variable/function declarations into the local scope.
    • arguments.callee was removed, (difficult to optimize (e.g. function inlining))
    • The arguments object index named properties are not anymore dynamically mapped to the named formal parameters.

提交回复
热议问题