Potential first locations can be quickly rejected if they're below or to the right of the best first fit location found so far. Sorting the offset edge interesections by increasing Y coordinate and then X, would make finding the optimal first fit location earlier.
Since the implementation no longer supports shape-inside and because of the changes introduced by https://bugs.webkit.org/show_bug.cgi?id=130975, this bug is no longer relevant.