Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
floor 2989766.5 Ops/sec
~~ 5773875.5 Ops/sec
>> 0 5790538.5 Ops/sec
| 0 5808346.5 Ops/sec
<< 0 5700032.5 Ops/sec
& 0xFFFFFFFFFFFF 5826022.5 Ops/sec
^ 0x000000000000 5729904.0 Ops/sec
Math.trunc() 3000373.0 Ops/sec
x - (x % 1) 3861239.5 Ops/sec
parseInt() 2937377.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()