Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Chrome 120
Windows
Desktop
one year ago
Test name Executions per second
floor 2823175.8 Ops/sec
~~ 5710082.5 Ops/sec
>> 0 5713442.0 Ops/sec
| 0 5722325.5 Ops/sec
<< 0 5935947.5 Ops/sec
& 0xFFFFFFFFFFFF 5799194.0 Ops/sec
^ 0x000000000000 5758079.0 Ops/sec
Math.trunc() 3067439.5 Ops/sec
x - (x % 1) 3815820.2 Ops/sec
parseInt() 3037300.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()