According to this test "strict mode" can be about 25% faster.
<div id="a">
Q
</div>
<div id="b">
Q
</div>
<script>
Benchmark.prototype.setup = function() {
function d(i) {
var x = '999';
y = eval("y = 8;");
var z = x + y + i;
document.getElementById('a').innerHTML = z;
}
function c(i) {
'use strict'
var x = '999';
var y = eval("y = 8;");
var z = x + y + i;
document.getElementById('b').innerHTML = z;
}
};
</script>
This can be tested here:
http://jsperf.com/strict-mode
Interestingly, manipulation of the arguments array can be around 6 times faster in "strict mode"!
<script>
Benchmark.prototype.setup = function() {
var nonstrict = (function() {
return function (arg1) {
var index;
for (index = 1; index < arguments.length; ++index) {
arguments[0] += arguments[index];
}
return arguments[0] - arg1;
};
}());
var strict = (function() {
"use strict";
return function (arg1) {
var index;
for (index = 1; index < arguments.length; ++index) {
arguments[0] += arguments[index];
}
return arguments[0] - arg1;
};
}());
var result;
};
</script>
Here's the jsPerf test: http://jsperf.com/strict-mode-arguments
strict mode
isn't going to matter for a while (in browsers). – Handcraftwith
keyword not only performs badly, but just having it in the language makes the entire language slower. This link from CMS' answer says thewith
keyword doesn't work in strict mode, so that would seem to indicate at least the potential for some speed-up. – Withdrawal