diff --git a/models/PhotoMosaic.php b/models/PhotoMosaic.php index 71981f0c..8326e1da 100644 --- a/models/PhotoMosaic.php +++ b/models/PhotoMosaic.php @@ -220,6 +220,10 @@ class PhotoMosaic { $score = $this->getScoreForRow($imageSelection, $requiredImageTypes); $fitnessScores[$layout] = [$score, $imageSelection]; + + // Perfect score? Bail out early + if ($score === count($requiredImageTypes)) + break; } }