Test name | Executions per second |
---|---|
Right shift | 14431.3 Ops/sec |
Divide and floor | 644.0 Ops/sec |
Divide and floor 2 | 11045.2 Ops/sec |
var arr = new Array(10000).fill(0).map(() => Math.random() * 10);
arr.map(n => n >> 1);
arr.map(n => Math.floor(n / 2));
arr.map(n => ~~(n / 2));