for length bench

JavaScript performance comparison

Test case created by Simon

Preparation code

<script>

var list = [];
for (var i = 0; i < 99999; i++) {
list.push(i);
}

</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
.length
var a = [];
for (var i = 0; i < list.length; i++) {
  a.push(i);
}
pending…
var l
var a = [];
var l = list.length;
for (var i = 0; i < l; i++) {
  a.push(i);
}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

1 comment

Corey commented :

TypeError: 'undefined' is not an object.

message: TypeError: 'undefined' is not an object fileName: undefined lineNumber: 0

Add a comment