Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
Chrome 101
Mac OS X 10.14.6
Desktop
2 years ago
Test name Executions per second
floor 3529196.0 Ops/sec
~~ 6763101.0 Ops/sec
>> 0 6313444.0 Ops/sec
| 0 6198933.5 Ops/sec
<< 0 6466641.5 Ops/sec
& 0xFFFFFFFFFFFF 6610371.5 Ops/sec
^ 0x000000000000 6968687.0 Ops/sec
Math.trunc() 3545176.5 Ops/sec
x - (x % 1) 4623889.5 Ops/sec
parseInt() 3501546.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()