Test name | Executions per second |
---|---|
array sort | 604.5 Ops/sec |
typedArray sort | 14159.2 Ops/sec |
array i/o | 528.2 Ops/sec |
typedArray i/o | 536.1 Ops/sec |
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
var a = [Array(10000)].map(_ => Math.random(1000000));
var ta = (new Float32Array(10000)).map(_ => Math.random(1000000));
a.sort();
ta.sort();
for (let i = 0; i < 10000; ++i) {
a[i] = a[i] + 1;
}
for (let i = 0; i < 10000; ++i) {
ta[i] = ta[i] + 1;
}