Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Chrome 84
Windows
Desktop
4 years ago
Test name Executions per second
floor 1531867.9 Ops/sec
~~ 2550666.8 Ops/sec
>> 0 2562817.0 Ops/sec
| 0 2519934.2 Ops/sec
<< 0 2553943.2 Ops/sec
& 0xFFFFFFFFFFFF 2552329.2 Ops/sec
^ 0x000000000000 2567977.0 Ops/sec
Math.trunc() 1536805.4 Ops/sec
x - (x % 1) 1801318.9 Ops/sec
parseInt() 1415242.1 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()