Optimize makeGrid() and makeRegularGrid()
Review Request #112606 - Created Sept. 11, 2013 and submitted
The performance improvement from this change depends on the number of grid cells, but is close to 100% when used by the wobbly-windows effect. commit 40684e2649c014f9dab7cc9ad07e5ba888eb4147 Author: Fredrik Höglund <email@example.com> Date: Mon Sep 9 17:28:46 2013 +0200 kwin: Optimize WindowQuadList::makeGrid() This is the same optimization as in the previous commit. commit ccf18dcd9604e0a4a413a80659223b966f74e035 Author: Fredrik Höglund <firstname.lastname@example.org> Date: Mon Sep 9 17:26:23 2013 +0200 kwin: Optimize WindowQuadList::makeRegularGrid() Instead of looping over every quad for every grid cell and checking for possible intersections, loop over the quads once and compute the top left corner of the first intersecting grid cell. Then loop over all the intersecting cells from that point, and create the sub quads. This algorithm also preserves the order of the quads in the original list.
Interesting approach (i mean on the left ;-) I guess there's no requirement to special case applying a wide grid on very finegrained quads? Either way, the algorithm is a definite "Ship it!" from here (unless Martin has merge conflict concerns? - and probably even despite...) and i didn't spot an error in the implementation either.