access element

JavaScript performance comparison

Test case created

Preparation code

var test = {
   abc : ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
}
<script>
Benchmark.prototype.setup = function() {
    var count = test.abc.length;
    var letters = test.abc;
    var letter;
};
</script>

Preparation code output

var test = { abc : ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] }

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
direct
for(var i = 0; i < count; i++){
    letter = test.abc[i];
}
pending…
reference
for(var i = 0; i < count; i++){
    letter = letters[i];
}
pending…

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

Compare results of other browsers

0 comments

Add a comment