workspace: Use set_origin/set_size instead of properties when allocating

Setting four properties is more expensive than calling two C functions,
so move to set_origin()/set_size() calls for our ClutterActorBox
handling.

This gets us down to an average time of 2.1 ms spent in vfunc_allocate()
with 20 windows

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
This commit is contained in:
Jonas Dreßler 2021-02-25 11:54:39 +01:00 committed by Marge Bot
parent e75f3a8aed
commit 3e9a08a2e1

View File

@ -635,10 +635,12 @@ var WorkspaceLayout = GObject.registerClass({
const windowInfo = this._windows.get(child);
if (windowInfo.metaWindow.showing_on_its_workspace()) {
workspaceBox.x1 = child.boundingBox.x - this._workarea.x;
workspaceBox.x2 = workspaceBox.x1 + child.boundingBox.width;
workspaceBox.y1 = child.boundingBox.y - this._workarea.y;
workspaceBox.y2 = workspaceBox.y1 + child.boundingBox.height;
workspaceBox.set_origin(
child.boundingBox.x - this._workarea.x,
child.boundingBox.y - this._workarea.y);
workspaceBox.set_size(
child.boundingBox.width,
child.boundingBox.height);
} else {
workspaceBox.set_origin(this._workarea.x, this._workarea.y);
workspaceBox.set_size(0, 0);
@ -659,10 +661,8 @@ var WorkspaceLayout = GObject.registerClass({
Math.max(workspaceBox.get_height(), height));
}
layoutBox.x1 = x;
layoutBox.x2 = layoutBox.x1 + width;
layoutBox.y1 = y;
layoutBox.y2 = layoutBox.y1 + height;
layoutBox.set_origin(x, y);
layoutBox.set_size(width, height);
childBox = workspaceBox.interpolate(layoutBox,
this._stateAdjustment.value);