Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Chrome 108
Windows
Desktop
2 years ago
Test name Executions per second
floor 4848524.5 Ops/sec
~~ 8712008.0 Ops/sec
>> 0 8598605.0 Ops/sec
| 0 8664076.0 Ops/sec
<< 0 8609732.0 Ops/sec
& 0xFFFFFFFFFFFF 8594099.0 Ops/sec
^ 0x000000000000 8574585.0 Ops/sec
Math.trunc() 4775754.5 Ops/sec
x - (x % 1) 5467038.5 Ops/sec
parseInt() 4809032.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()