assign_spaces_in_array

JavaScript performance comparison

Test case created by Tomas Corral

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var aArray = [];
};

Benchmark.prototype.teardown = function() {
    console.log(aArray.length);
    if (aArray.length !== 10) {
      throw new Error('no tamañó');
    }
};
</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
aArray = new Array(10);
pending…
assigned
aArray = [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined];
pending…
length
aArray.length = 10;
pending…
push
aArray.push(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
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:

0 comments

Add a comment