TypedArray Copy

JavaScript performance comparison

Test case created by Simon Robertson

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var a = new Uint8Array(1024);
  var b = new Uint8Array(2048);

};
</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
Set
b.set(a, 0);
pending…
While
var i = 0;
var n = a.length;

while (i < n) {
    b[i] = a[i ++];
}
pending…
For
for (var i = 0, n = a.length; i < n; i ++) {
    b[i] = a[i];
}
pending…

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments