ecmascript 5 - Does JavaScript (ECMAScript5) Strict Mode offer significant performance advantages to merit widespread use? -
i'm reading bit on using strict mode javascript , seems that, speaking, idea force more rigid set of rules onto coder ensure js engine can optimise code better. feels javascript equivalent of "option explicit" in visual basic.
if net effect of applying strict mode code, performance difference such worth applying out of habit rather case-by-case? there other advantages besides code stability might worth considering?
what of key reasons want apply strict mode scripts?
well, strict mode code can perform better because removes issues made optimization harder, example, top of head:
- the
with
statement removed (really difficult -if not impossible- optimize). - no more undeclared assignments, , other prohibitions, e.g. (
delete varname;
) eval
not introduce variable/function declarations local scope.arguments.callee
removed, (difficult optimize (e.g. function inlining))- the
arguments
object index named properties not anymore dynamically mapped named formal parameters.
Comments
Post a Comment