Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
floor 2955464.8 Ops/sec
~~ 5369183.5 Ops/sec
>> 0 5659117.5 Ops/sec
| 0 5543615.5 Ops/sec
<< 0 5472870.0 Ops/sec
& 0xFFFFFFFFFFFF 5423548.0 Ops/sec
^ 0x000000000000 5651210.0 Ops/sec
Math.trunc() 1885136.6 Ops/sec
x - (x % 1) 3616148.2 Ops/sec
parseInt() 3221588.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()