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 235467296.0 Ops/sec
~~ 283916160.0 Ops/sec
>> 0 279033760.0 Ops/sec
| 0 279405920.0 Ops/sec
<< 0 275563488.0 Ops/sec
& 0xFFFFFFFFFFFF 273812576.0 Ops/sec
^ 0x000000000000 270268640.0 Ops/sec
Math.trunc() 276814048.0 Ops/sec
x - (x % 1) 291201920.0 Ops/sec
parseInt() 15374265.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()