Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
Firefox 81
Windows
Desktop
4 years ago
Test name Executions per second
floor 111047800.0 Ops/sec
~~ 198690896.0 Ops/sec
>> 0 193437280.0 Ops/sec
| 0 195847248.0 Ops/sec
<< 0 197199568.0 Ops/sec
& 0xFFFFFFFFFFFF 196711920.0 Ops/sec
^ 0x000000000000 184248640.0 Ops/sec
Math.trunc() 106472480.0 Ops/sec
x - (x % 1) 53021952.0 Ops/sec
parseInt() 27321538.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()