Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130
Mac OS X 10.15.7
Desktop
one month ago
Test name Executions per second
floor 5655753.0 Ops/sec
~~ 8074724.5 Ops/sec
>> 0 8084717.5 Ops/sec
| 0 8039210.0 Ops/sec
<< 0 8048110.0 Ops/sec
& 0xFFFFFFFFFFFF 8036083.5 Ops/sec
^ 0x000000000000 8081344.5 Ops/sec
Math.trunc() 5646434.0 Ops/sec
x - (x % 1) 4617375.0 Ops/sec
parseInt() 5654565.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()