Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36
Chrome 112
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
floor 4493166.5 Ops/sec
~~ 8380310.5 Ops/sec
>> 0 8377748.0 Ops/sec
| 0 8497140.0 Ops/sec
<< 0 8444912.0 Ops/sec
& 0xFFFFFFFFFFFF 8459143.0 Ops/sec
^ 0x000000000000 8391550.0 Ops/sec
Math.trunc() 4356318.0 Ops/sec
x - (x % 1) 5515231.5 Ops/sec
parseInt() 4398491.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()


;