Uint32Array read performance

JavaScript performance comparison

Revision 6 of this test case created by Walter

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var n = 10000;
    var array = new Array(n);
    var uint32Array = new Uint32Array(n);
    var int32Array = new Int32Array(n);
    for (var i = 0; i < n; i++) {
      array[i] = n;
      uint32Array[i] = n;
      int32Array[i] = n;
    };
};
</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
Normal array
var value = 0;
for (var i = 0; i < n; i++) {
  value |= array[i];
};
console.log(value);
pending…
Uint32 array
var value = 0;
for (var i = 0; i < n; i++) {
  value |= uint32Array[i];
};
console.log(value);
pending…
Int32 array
var value = 0;
for (var i = 0; i < n; i++) {
  value |= int32Array[i];
};
console.log(value);
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