tags:

views:

78

answers:

1

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?

Edit: Since none of the major engines actually implement strict mode, I'll rephrase slightly: Is strict mode intended, amongst its other goals, to allow browsers to introduce additional optimisations or other performance enhancements?

+2  A: 

The strict mode is not really about performance, it a strict variant of the language, its main goal is to avoid what are considered to be error-prone features.

Basically its goal is to make the language safer, introducing are a lot of semantical changes, also additional error checking is made, and erros are noisy, in non-strict code things only silently fail.

About performance, I think browser vendors are now having a hard time now implementing strict mode, the problem is that the JS engines are mostly based on ECMAScript 3, and implementing the strict mode is not easy, since the scope of strictness is very flexible, you can mix non-strict and strict code.

See also:

CMS
+1 for the links. I don't quite see how that third sentence has anything to do with performance though.
sje397
from [here](http://clipperhouse.com/blog/post/Javastrict.aspx) (seems credible): 'What John [Resig] doesn't mention is that strict mode will probably lead to greater performance. If the browser is told "I declare this code to be good and right", it can spend less time handling ambiguities, and get on to the business at hand.'
sje397