workspace: Get some values outside the children loop when allocating
It turned out that getting properties and saving them to a variable outside of loops instead of accessing them everytime inside the loop can have significant impact on performance, so do that in Workspaces vfunc_allocate(). Here the impact is not that large, about 0.05 ms with 20 open windows, that still seems worth it though. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
This commit is contained in:
parent
5792b98f79
commit
650e0960a2
@ -609,7 +609,12 @@ var WorkspaceLayout = GObject.registerClass({
|
||||
this._windowSlots = this._getWindowSlots(box.copy());
|
||||
}
|
||||
|
||||
const allocationScale = containerBox.get_width() / this._workarea.width;
|
||||
const workareaX = this._workarea.x;
|
||||
const workareaY = this._workarea.y;
|
||||
const workareaWidth = this._workarea.width;
|
||||
const stateAdjustementValue = this._stateAdjustment.value;
|
||||
|
||||
const allocationScale = containerBox.get_width() / workareaWidth;
|
||||
|
||||
const workspaceBox = new Clutter.ActorBox();
|
||||
const layoutBox = new Clutter.ActorBox();
|
||||
@ -628,16 +633,16 @@ var WorkspaceLayout = GObject.registerClass({
|
||||
|
||||
if (windowInfo.metaWindow.showing_on_its_workspace()) {
|
||||
workspaceBox.set_origin(
|
||||
child.boundingBox.x - this._workarea.x,
|
||||
child.boundingBox.y - this._workarea.y);
|
||||
child.boundingBox.x - workareaX,
|
||||
child.boundingBox.y - workareaY);
|
||||
workspaceBox.set_size(
|
||||
child.boundingBox.width,
|
||||
child.boundingBox.height);
|
||||
} else {
|
||||
workspaceBox.set_origin(this._workarea.x, this._workarea.y);
|
||||
workspaceBox.set_origin(workareaX, workareaY);
|
||||
workspaceBox.set_size(0, 0);
|
||||
|
||||
child.opacity = this._stateAdjustment.value * 255;
|
||||
child.opacity = stateAdjustementValue * 255;
|
||||
}
|
||||
|
||||
workspaceBox.scale(allocationScale);
|
||||
@ -657,7 +662,7 @@ var WorkspaceLayout = GObject.registerClass({
|
||||
layoutBox.set_size(width, height);
|
||||
|
||||
const childBox = workspaceBox.interpolate(layoutBox,
|
||||
this._stateAdjustment.value);
|
||||
stateAdjustementValue);
|
||||
|
||||
if (windowInfo.currentTransition) {
|
||||
windowInfo.currentTransition.get_interval().set_final(childBox);
|
||||
|
Loading…
Reference in New Issue
Block a user