Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Mac OS X 10.15.7
Desktop
10 months ago
Test name Executions per second
floor 8450463.0 Ops/sec
~~ 15120042.0 Ops/sec
>> 0 15159238.0 Ops/sec
| 0 14992046.0 Ops/sec
<< 0 14956363.0 Ops/sec
& 0xFFFFFFFFFFFF 14884479.0 Ops/sec
^ 0x000000000000 14776810.0 Ops/sec
Math.trunc() 8263575.5 Ops/sec
x - (x % 1) 7824356.5 Ops/sec
parseInt() 8242207.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()