Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Chrome 100
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
floor 3317947.5 Ops/sec
~~ 6387167.5 Ops/sec
>> 0 6514907.5 Ops/sec
| 0 6604164.0 Ops/sec
<< 0 6442646.0 Ops/sec
& 0xFFFFFFFFFFFF 6584294.0 Ops/sec
^ 0x000000000000 6545544.5 Ops/sec
Math.trunc() 3403480.0 Ops/sec
x - (x % 1) 4046055.8 Ops/sec
parseInt() 3110085.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()