Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Chrome 115
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
floor 4527234.5 Ops/sec
~~ 8195775.0 Ops/sec
>> 0 8323470.0 Ops/sec
| 0 8368950.5 Ops/sec
<< 0 8208846.5 Ops/sec
& 0xFFFFFFFFFFFF 7941478.0 Ops/sec
^ 0x000000000000 8195197.0 Ops/sec
Math.trunc() 4267952.0 Ops/sec
x - (x % 1) 5699456.0 Ops/sec
parseInt() 4475899.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()


;