Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36
Chrome 101
Windows
Desktop
2 years ago
Test name Executions per second
floor 1355085.9 Ops/sec
~~ 2566427.8 Ops/sec
>> 0 2569750.2 Ops/sec
| 0 2665438.2 Ops/sec
<< 0 2658830.5 Ops/sec
& 0xFFFFFFFFFFFF 2673717.5 Ops/sec
^ 0x000000000000 2655367.2 Ops/sec
Math.trunc() 1329744.6 Ops/sec
x - (x % 1) 1777864.0 Ops/sec
parseInt() 1434106.1 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()