Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36
Chrome 88
Mac OS X 11.1.0
Desktop
3 years ago
Test name Executions per second
floor 3233256.2 Ops/sec
~~ 6363912.5 Ops/sec
>> 0 6621987.0 Ops/sec
| 0 6643276.0 Ops/sec
<< 0 6615749.0 Ops/sec
& 0xFFFFFFFFFFFF 6631967.0 Ops/sec
^ 0x000000000000 6652741.0 Ops/sec
Math.trunc() 3167428.2 Ops/sec
x - (x % 1) 3992902.0 Ops/sec
parseInt() 2941514.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()