Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Firefox 78
Linux
Desktop
3 years ago
Test name Executions per second
floor 7063700.5 Ops/sec
~~ 8235000.0 Ops/sec
>> 0 8576824.0 Ops/sec
| 0 8533817.0 Ops/sec
<< 0 8485440.0 Ops/sec
& 0xFFFFFFFFFFFF 8751302.0 Ops/sec
^ 0x000000000000 8760576.0 Ops/sec
Math.trunc() 6465766.5 Ops/sec
x - (x % 1) 6274052.5 Ops/sec
parseInt() 6564334.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()