Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134
Linux
Desktop
15 days ago
Test name Executions per second
Right shift 27334.3 Ops/sec
Divide and floor 23992.2 Ops/sec
Script Preparation code:
AخA
 
var arr = new Array(10000).fill(0).map(() => Math.random() * 10);
Tests:
  • Right shift

     
    arr.map(n => n >> 1);
  • Divide and floor

     
    arr.map(n => Math.floor(n / 2));