Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131
Mac OS X 10.15.7
Desktop
one month ago
Test name Executions per second
floor 2440948.0 Ops/sec
~~ 3458819.0 Ops/sec
>> 0 3446758.2 Ops/sec
| 0 3394397.0 Ops/sec
<< 0 3453900.0 Ops/sec
& 0xFFFFFFFFFFFF 3472977.0 Ops/sec
^ 0x000000000000 3448518.0 Ops/sec
Math.trunc() 2435799.8 Ops/sec
x - (x % 1) 2367147.5 Ops/sec
parseInt() 2417891.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()