Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Mac OS X 11.2.3
Desktop
3 years ago
Test name Executions per second
floor 5550472.5 Ops/sec
~~ 10941249.0 Ops/sec
>> 0 10942873.0 Ops/sec
| 0 10941546.0 Ops/sec
<< 0 10946452.0 Ops/sec
& 0xFFFFFFFFFFFF 10964338.0 Ops/sec
^ 0x000000000000 10965089.0 Ops/sec
Math.trunc() 5570006.5 Ops/sec
x - (x % 1) 5643397.0 Ops/sec
parseInt() 5343373.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()