TypedArray vs. Array

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var temp_typed_array = new Float32Array(65536);
    var temp_array = new Array(65536);
         
    var access_array = new Array(1024);
    for(var i=0; i<access_array.length; ++i)
      access_array[i] = Math.floor(Math.random() * 65536);
   
    var temp = 0;
};
</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
TypedArray (random read)
for(var i=0; i<1024; ++i)
  temp += temp_typed_array[access_array[i]];
pending…
Array (random read)
for(var i=0; i<1024; ++i)
  temp += temp_array[access_array[i]];
pending…
TypedArray (sequencial read)
for(var i=0; i<1024; ++i)
  temp += temp_typed_array[i];
pending…
Array (sequencial read)
for(var i=0; i<1024; ++i)
  temp += temp_array[i];
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