allocation rate

JavaScript performance comparison

Test case created by Andy Wingo

Info

A test to measure the sustainable raw allocation rate by JavaScript engines.

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var ITERATIONS = 1000000;
   
};
</script>

Test runner

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

Java applet disabled.

Testing in Firefox 9.0.1
Test Ops/sec
baseline loop without allocation
var _ = 0;
for (var i = 0; i < ITERATIONS; i++)
  _ += i;
pending…
loop allocating 1-element arrays
var _ = 0;
for (var i = 0; i < ITERATIONS; i++) {
  var x = [i];
  _ += x[0];
}
 
pending…
loop allocating 2-element arrays
var _ = 0;
for (var i = 0; i < ITERATIONS; i++) {
  var x = [i,i];
  _ += x[1];
}
 
pending…
loop allocating 4-element arrays
var _ = 0;
for (var i = 0; i < ITERATIONS; i++) {
  var x = [i,i,i,i];
  _ += x[3];
}
 
pending…
loop allocating 8-element arrays
var _ = 0;
for (var i = 0; i < ITERATIONS; i++) {
  var x = [i,i,i,i,i,i,i,i];
  _ += x[7];
}
 
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

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.