Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
Chrome 90
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
floor 3864306.2 Ops/sec
~~ 7108517.0 Ops/sec
>> 0 7092327.5 Ops/sec
| 0 7050432.5 Ops/sec
<< 0 7137893.5 Ops/sec
& 0xFFFFFFFFFFFF 7164685.0 Ops/sec
^ 0x000000000000 7187558.0 Ops/sec
Math.trunc() 3922445.5 Ops/sec
x - (x % 1) 4871357.0 Ops/sec
parseInt() 3972595.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()