Boost `layoutAttributesForElementsInRect` performance.