How does \Magento\Eav\Model\Entity\Attribute::getSortWeight() work?

Context: How does \Magento\Eav\Model\Entity\AbstractEntity::attributesCompare() work?