Array Comparison

JavaScript performance comparison

Revision 4 of this test case created by sutekidayo

Preparation code

<script>
var N = 10000;
var float32Array = new Float32Array(N);
var float64Array = new Float64Array(N);
var jsArray = new Array(N);
</script>
      
<script>
Benchmark.prototype.setup = function() {
  for (var i = 0; i < N; i++) {
    float32Array[i] = Math.random();
    float64Array[i] = Math.random();
    jsArray[i] = Math.random();
  }

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
JS Array
for (var i = 0; i < N; i++) {
  jsArray[i] = 0;
}
pending…
Float32Array
for (var i = 0; i < N; i++) {
  float32Array[i] = 0;
}
pending…
Float64Array
for (var i = 0; i < N; i++) {
  float64Array[i] = 0;
}
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.

0 Comments