Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0
Firefox 83
Linux
Desktop
4 years ago
Test name Executions per second
floor 242481824.0 Ops/sec
~~ 238937520.0 Ops/sec
>> 0 252948576.0 Ops/sec
| 0 257976528.0 Ops/sec
<< 0 249791568.0 Ops/sec
& 0xFFFFFFFFFFFF 253688656.0 Ops/sec
^ 0x000000000000 247331152.0 Ops/sec
Math.trunc() 215838096.0 Ops/sec
x - (x % 1) 260465776.0 Ops/sec
parseInt() 14923998.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()