GoT length vs var len

Benchmark created by Okke on


Setup

var x = 10000;
    function doSomething() {
        // do nothing
    }

Test runner

Ready to run.

Testing in
TestOps/sec
length
for(i = 0; i< x.length; i++){ 
    doSomething();
}
ready
var len
var len = x.length;
for(i = 0; i<len; i++){ 
    doSomething();
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Okke on