Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Chrome 107
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
floor 3910397.0 Ops/sec
~~ 7378062.5 Ops/sec
>> 0 7413153.5 Ops/sec
| 0 7329842.0 Ops/sec
<< 0 7457059.5 Ops/sec
& 0xFFFFFFFFFFFF 7341958.5 Ops/sec
^ 0x000000000000 7266147.0 Ops/sec
Math.trunc() 3999647.8 Ops/sec
x - (x % 1) 4969793.5 Ops/sec
parseInt() 3897656.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()