[gnome-shell] workspace: Iterate windowSlots directly when allocating
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspace: Iterate windowSlots directly when allocating
- Date: Tue, 9 Mar 2021 15:48:59 +0000 (UTC)
commit e75f3a8aed2054671643c9be3133fb58e3e60330
Author: Jonas Dreßler <verdre v0yd nl>
Date: Thu Feb 25 11:50:44 2021 +0100
workspace: Iterate windowSlots directly when allocating
We can save a little bit of time in this loop by iterating directly
over the windowSlots array instead of iterating through children and
then performing a search for the windowSlot. This saves more time and we
only spend 2.2 ms instead of 2.3 ms in vfunc_allocate() now.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
js/ui/workspace.js | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 4fa113bac3..37b13a46b1 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -626,19 +626,12 @@ var WorkspaceLayout = GObject.registerClass({
const inSessionTransition =
this._overviewAdjustment.value <= ControlsState.WINDOW_PICKER;
- for (const child of container) {
+ const nSlots = this._windowSlots.length;
+ for (let i = 0; i < nSlots; i++) {
+ const [x, y, width, height, child] = this._windowSlots[i];
if (!child.visible)
continue;
- // The fifth element in the slot array is the WindowPreview
- const index = this._windowSlots.findIndex(s => s[4] === child);
- if (index === -1) {
- log('Couldn\'t find child %s in window slots'.format(child));
- child.allocate(childBox);
- continue;
- }
-
- const [x, y, width, height] = this._windowSlots[index];
const windowInfo = this._windows.get(child);
if (windowInfo.metaWindow.showing_on_its_workspace()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]