Run details:
Mozilla/5.0 (Linux; Android 13; Pixel 7 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36
Chrome Mobile 109
Android
Mobile
one year ago
Test name Executions per second
floor 2488463.5 Ops/sec
~~ 4637190.0 Ops/sec
>> 0 4643418.5 Ops/sec
| 0 4665722.0 Ops/sec
<< 0 4659269.5 Ops/sec
& 0xFFFFFFFFFFFF 4655771.0 Ops/sec
^ 0x000000000000 4648296.5 Ops/sec
Math.trunc() 2472213.2 Ops/sec
x - (x % 1) 2950711.5 Ops/sec
parseInt() 2477732.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()