Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.55
Chrome 109
Windows
Desktop
one year ago
Test name Executions per second
floor 4624440.5 Ops/sec
~~ 8402057.0 Ops/sec
>> 0 8432987.0 Ops/sec
| 0 8428635.0 Ops/sec
<< 0 8424580.0 Ops/sec
& 0xFFFFFFFFFFFF 8407806.0 Ops/sec
^ 0x000000000000 8439269.0 Ops/sec
Math.trunc() 4634908.5 Ops/sec
x - (x % 1) 5405680.0 Ops/sec
parseInt() 4694829.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()


;