Typed array copy speed vs copy size

JavaScript performance comparison

Test case created

Info

Seeing if there is a speed differential for the size of a typed array .set copy.

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var a = new Uint32Array(100000);
    var b = new Uint32Array(100000);
    var c = new Uint32Array(10000);
    var d = new Uint32Array(1000);
    var d2 = new Uint32Array(500);
    var d3 = new Uint32Array(200);
    var e = new Uint32Array(100);
    var e2 = new Uint32Array(50);
    var f = new Uint32Array(10);
    var g = new Uint32Array(5);
    var h = new Uint32Array(2);
    var i = new Uint32Array(1);
};
</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
a) 100k to 100k
a.set(b, 0);
pending…
b) 10k
for(var rep=0;rep<10;rep++){
a.set(c, rep*10000);
}
pending…
c) 1k
for(var rep=0;rep<100;rep++){
a.set(d, rep*1000);
}
pending…
f) 100
for(var rep=0;rep<1000;rep++){
a.set(e, rep*100);
}
pending…
h) 10
for(var rep=0;rep<10000;rep++){
a.set(f, rep*10);
}
pending…
i) 5
for(var rep=0;rep<20000;rep++){
a.set(g, rep*5);
}
pending…
j) 2
for(var rep=0;rep<50000;rep++){
a.set(h, rep*2);
}
pending…
k) 1
for(var rep=0;rep<100000;rep++){
a.set(i, rep);
}
pending…
d) 500
for(var rep=0;rep<200;rep++){
a.set(d2, rep*500);
}
pending…
e) 200
for(var rep=0;rep<500;rep++){
a.set(d3, rep*200);
}
pending…
g) 50
for(var rep=0;rep<2000;rep++){
a.set(e2, rep*50);
}
pending…

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

Compare results of other browsers

0 comments

Add a comment