native vs typed js array speed

JavaScript performance comparison

Revision 25 of this test case created by

Preparation code

<script>
  var arraySize = 2000;
  var nativeArray = new Array(arraySize);
  var int8Array = new Int8Array(arraySize);
  var int16Array = new Int16Array(arraySize);
  var int32Array = new Int32Array(arraySize);
  var float32Array = new Float32Array(arraySize);
  var float64Array = new Float64Array(arraySize);

</script>
      
<script>
Benchmark.prototype.setup = function() {
  var sum = 0;
  

};
</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
Native Read
pending…
Int32 Read
pending…
Float32 Write
pending…
Native Write
for (var j=5,i = 0; i < arraySize; ++i) {
  nativeArray[i] = (j*(12*i)+i)%/10;
}
pending…
Int32 Write
for (var j=5,i = 0; i < arraySize; ++i) {
  int32Array[i] = (j*(12*i)+i)%/10;
}
pending…
Float32 Read
pending…
Int16 Write
pending…
Int16 Read
pending…
Int8 Write
pending…
Int8 Read
pending…
Alternative Native Write
pending…
Float64 Read
pending…
Float64 Write
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