array creation+index

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    empty = []
    full = [0,0,0,0,0,0,0,0,0,0]
};
</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
new
array = []

array[0] = 1
array[1] = 1
array[2] = 1
array[3] = 1
array[4] = 1
array[5] = 1
array[6] = 1
array[7] = 1
array[8] = 1
pending…
empty
empty[0] = 1
empty[1] = 1
empty[2] = 1
empty[3] = 1
empty[4] = 1
empty[5] = 1
empty[6] = 1
empty[7] = 1
empty[8] = 1
pending…
full
full[0] = 1
full[1] = 1
full[2] = 1
full[3] = 1
full[4] = 1
full[5] = 1
full[6] = 1
full[7] = 1
full[8] = 1
pending…
class prep
array = new Array(9)

array[0] = 1
array[1] = 1
array[2] = 1
array[3] = 1
array[4] = 1
array[5] = 1
array[6] = 1
array[7] = 1
array[8] = 1
pending…
syntax prep
array = [0,0,0,0,0,0,0,0,0,0]

array[0] = 1
array[1] = 1
array[2] = 1
array[3] = 1
array[4] = 1
array[5] = 1
array[6] = 1
array[7] = 1
array[8] = 1
pending…
conditional full
if (full == null) {full = new Array(9);}

full[0] = 1
full[1] = 1
full[2] = 1
full[3] = 1
full[4] = 1
full[5] = 1
full[6] = 1
full[7] = 1
full[8] = 1
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