Bail early from check over all permutations

If we're already doing worse than the best so far there is
no need to continue checking this particular permutation.

https://bugzilla.gnome.org/show_bug.cgi?id=609258
This commit is contained in:
Alexander Larsson 2011-03-03 16:29:05 +01:00
parent df2f939f3a
commit 16a675b7ce

View File

@ -735,6 +735,12 @@ Workspace.prototype = {
let delta = this._computeWindowMotion(cloneActor, slot);
motion += delta;
// Bail out early if we're already larger than the
// previous best
if (minimumMotionPermutation != null &&
motion > minimumMotion)
continue;
}
if (minimumMotionPermutation == null || motion < minimumMotion) {