performance-tuning-$3.lzx
<canvas height="150" width="100%">
<include href="utils/performance"/>
<script>
var iterations = Measurement.defaultIterations;
var j;
function empty () {
for (var i = 0; i < iterations; i++) {
j = i;
}
}
function globalReference () {
for (var i = 0; i < iterations; i++) {
j = Math.PI;
}
}
function cachedGlobalReference() {
var PI = Math.PI;
for (var i = 0; i < iterations; i++) {
j = PI;
}
}
(new Measurement({'Global reference': globalReference,
'Cached global reference': cachedGlobalReference,
'empty': empty})).run();
</script>
</canvas>
Cross References
Includes