From 3e9a08a2e1e7b644247d4fa01b2ecfe27eae8bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 25 Feb 2021 11:54:39 +0100 Subject: [PATCH] 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: --- js/ui/workspace.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 37b13a46b..3337b2ed0 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -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);