Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Chrome 107
Mac OS X 10.13.4
Desktop
2 years ago
Test name Executions per second
floor 3528907.8 Ops/sec
~~ 6792050.0 Ops/sec
>> 0 6780096.5 Ops/sec
| 0 6811691.5 Ops/sec
<< 0 6730554.0 Ops/sec
& 0xFFFFFFFFFFFF 6681214.5 Ops/sec
^ 0x000000000000 6636929.0 Ops/sec
Math.trunc() 3459517.5 Ops/sec
x - (x % 1) 4455544.5 Ops/sec
parseInt() 3504973.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()