TypedArray vs. Array

JavaScript performance comparison

Revision 3 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 = 47.11;
};
</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 write)
for(var i=0; i<1024; ++i)
  temp_typed_array[access_array[i]] = temp;
pending…
Array (random write)
for(var i=0; i<1024; ++i)
  temp_array[access_array[i]] = temp;
pending…
TypedArray (sequencial write)
for(var i=0; i<1024; ++i)
  temp_typed_array[i] = temp;
pending…
Array (sequencial write)
for(var i=0; i<1024; ++i)
  temp_array[i] = temp;
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