Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
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
Script Preparation code:
AخA
 
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));
Tests:
  • array sort

     
    a.sort();
  • typedArray sort

     
    ta.sort();
  • array i/o

     
    for (let i = 0; i < 10000; ++i) {
      a[i] = a[i] + 1;
    }
  • typedArray i/o

     
    for (let i = 0; i < 10000; ++i) {
      ta[i] = ta[i] + 1;
    }