native vs typed js array speed

JavaScript performance comparison

Revision 65 of this test case created by

Preparation code

<script>
  var arraySize = 800;
  var nComputeIterations = 10;

  var nativeArray;
  var float32Array;
  
  nativeArray = new Array(arraySize);
  float32Array = new Float32Array(arraySize);

  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 Write
for (var i = 0; i < arraySize; ++i) {
  nativeArray[i] = i*5.0 ;
}
pending…
Float32 Write
for (var i = 0; i < arraySize; ++i) {
  float32Array[i] = i*5.0;
}
pending…
Native Compute
for (var idx= 0; idx< arraySize-1; ++idx) {
    nativeArray[idx] += nativeArray[idx] * 2.0 - nativeArray[idx+1] / nativeArray[idx];
}
pending…
Float32 Compute
for (var idx = 0; idx < arraySize-1; ++idx) {
    float32Array[idx] += float32Array[idx] * 2.0 - float32Array[idx+1] / float32Array[idx];
}
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