Merge lp:~mzanetti/unity/phablet-unload-far-away-images into lp:unity/phablet

Proposed by Michael Zanetti
Status: Superseded
Proposed branch: lp:~mzanetti/unity/phablet-unload-far-away-images
Merge into: lp:unity/phablet
Diff against target: 154 lines (+29/-9)
10 files modified
Dash/Apps/ApplicationsFilterGrid.qml (+1/-1)
Dash/Apps/RunningApplicationTile.qml (+1/-1)
Dash/DashContent.qml (+20/-0)
Dash/GenericLensView.qml (+1/-1)
Dash/Music/AlbumTile.qml (+1/-1)
Dash/Music/CarouselDelegateMusic.qml (+1/-1)
Dash/People/CarouselDelegatePeople.qml (+1/-1)
Dash/People/Delegate.qml (+1/-1)
Dash/Video/CarouselDelegateVideo.qml (+1/-1)
Dash/Video/VideosFilterGrid.qml (+1/-1)
To merge this branch: bzr merge lp:~mzanetti/unity/phablet-unload-far-away-images
Reviewer Review Type Date Requested Status
Michał Sawicz Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+160083@code.launchpad.net

This proposal has been superseded by a proposal from 2013-06-06.

Commit message

Unload images on Dashes further away than 1 index from currentIndex.

Originally proposed by Kaleo, merged and completed.

Description of the change

On large screens (tested with 2540x1600 - similar to Nexus 10) this saves up to 70MB of memory after traversing all lens once. On smaller screens its obviously less (On the Galaxy Nexus ~ 15MB).

To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) wrote :

On the Nexus 10, when swiping to the Video lens, and then very quickly all the way to the Music lens, you can see the Images how they need to get loaded. Right now the UbuntuShapes are black while reloading the images, caused by this bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1132771. Once this bug is fixed, one can still see the images missing and appearing only a second after switching to a Dash. Is that still ok?

Another bug, again in the UbuntuShape, that gets visible with this change is this https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1171437. Once fixed, this shouldn't be an issue any more.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> On the Nexus 10, when swiping to the Video lens, and then very quickly all the
> way to the Music lens, you can see the Images how they need to get loaded.
> Right now the UbuntuShapes are black while reloading the images, caused by
> this bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1132771. Once this
> bug is fixed, one can still see the images missing and appearing only a second
> after switching to a Dash. Is that still ok?

Investigating a bit more, this only seems to be an issue on the Music and People lenses. The reason for that is that they get loaded from bottom to top. As currently LVWPH always shows ALL items, it takes a second until the topmost images are loaded. The rework of LVWPH will therefore improve this greatly as visible items will be loaded immediately

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

When switching lenses using the dash bar, the current-before-you-clicked lens disappears straight away.

We should delay the unloading a half a second or so to also reduce unnecessary reloads when quickly switching between lenses.

I would also later like to experiment with layers to keep a cache of the unloaded lenses' views.

And generally we need design input on what to do with long-loading images / lenses.

review: Needs Fixing
617. By Michael Zanetti

add a grace period before hiding lens

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

I'm wondering whether we could make UbuntuShape support automatic unloading, especially when items are not visible (through a bool property).

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> I'm wondering whether we could make UbuntuShape support automatic unloading,
> especially when items are not visible (through a bool property).

you mean like this?

UbuntuShape {
  unloadWhenIvisible: true
}

hmm... not sure...
* I still hope we can upstream our UbuntuShape to the SDK at some point.
* our ubuntushape can display Items, not only images. what would that do? unload all the items? walk through the children item tree and unload all the images in there? Seems to be too may different cases for such an API. Mostly people wouldn't use this property but still specifically select the things to unload themselves.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> When switching lenses using the dash bar, the current-before-you-clicked lens
> disappears straight away.
>
> We should delay the unloading a half a second or so to also reduce unnecessary
> reloads when quickly switching between lenses.

Fixed, btw.

> I would also later like to experiment with layers to keep a cache of the
> unloaded lenses' views.

Interesting idea... without having tested it I guess that will keep lots of megabytes in the graphics chip memory... Seems equally bad if not even worse on a first thought. I didn't think it fully through tho.

Revision history for this message
Michał Sawicz (saviq) wrote :

35 + property bool gracePeriodRunning: false

Do we actually need a separate property? Shouldn't just "running" on the Timer suffice?

49 + unloadTimer.start();

Hmm shouldn't we restart instead?

review: Needs Information
Revision history for this message
Michał Sawicz (saviq) wrote :

I got to 254M RSS with this patch, 300M without. I don't understand the raise in mem usage after having played with the dash as we're loading the whole thing from the get-go...

But anyway a nice save - and we should be able to reduce its impact by only loading images that are actually going to be visible.

Revision history for this message
Michał Sawicz (saviq) wrote :

Hey, any update on this?

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> 35 + property bool gracePeriodRunning: false
>
> Do we actually need a separate property? Shouldn't just "running" on the Timer
> suffice?

I need a property that tells me if the current dash has been the active one before switching away. The comparison could indeed happen on the timer but as some sort of property is needed anyways, I decided to also use it for the rest for better readability.

>
> 49 + unloadTimer.start();
>
> Hmm shouldn't we restart instead?

Ack. fixed

618. By Michael Zanetti

restart instead of start

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Hmm this makes the shell perform badly after some playing... If I scroll between lenses a few times and scroll the lenses themselves, at some point the shell starts to be really jerky and doesn't stop being so.

Happened both on a Galaxy Nexus and a Nexus 10.

Can you see if you can reproduce?

review: Needs Information
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Hmm this makes the shell perform badly after some playing... If I scroll
> between lenses a few times and scroll the lenses themselves, at some point the
> shell starts to be really jerky and doesn't stop being so.
>
> Happened both on a Galaxy Nexus and a Nexus 10.
>
> Can you see if you can reproduce?

Reproduced, created a test case and reported a bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1180794

Unmerged revisions

618. By Michael Zanetti

restart instead of start

617. By Michael Zanetti

add a grace period before hiding lens

616. By Michael Zanetti

Do not load images that are invisible and set lenses that are far to be invisible.

Initially proposed by Kaleo. Merged and completed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Dash/Apps/ApplicationsFilterGrid.qml'
2--- Dash/Apps/ApplicationsFilterGrid.qml 2013-04-15 14:31:47 +0000
3+++ Dash/Apps/ApplicationsFilterGrid.qml 2013-05-15 14:52:28 +0000
4@@ -50,7 +50,7 @@
5 text: model.column_4 ? model.column_4 : application.name // FIXME: this is temporary
6 imageWidth: units.gu(8)
7 imageHeight: units.gu(7.5)
8- source: icon.indexOf("/") == -1 ? "image://gicon/" + icon : icon
9+ source: visible ? (icon.indexOf("/") == -1 ? "image://gicon/" + icon : icon) : ""
10 onClicked: filterGrid.clicked(index, application.desktopFile);
11 }
12 }
13
14=== modified file 'Dash/Apps/RunningApplicationTile.qml'
15--- Dash/Apps/RunningApplicationTile.qml 2013-04-29 19:21:59 +0000
16+++ Dash/Apps/RunningApplicationTile.qml 2013-05-15 14:52:28 +0000
17@@ -76,7 +76,7 @@
18
19 ApplicationImage {
20 id: applicationImage
21- source: application
22+ source: visible ? application : ""
23 width: shapedApplicationImage.width
24 height: shapedApplicationImage.height
25 fillMode: ApplicationImage.PreserveAspectCrop
26
27=== modified file 'Dash/DashContent.qml'
28--- Dash/DashContent.qml 2013-04-29 23:47:43 +0000
29+++ Dash/DashContent.qml 2013-05-15 14:52:28 +0000
30@@ -107,6 +107,8 @@
31
32 delegate:
33 Loader {
34+ visible: (index >= ListView.view.currentIndex - 1 && index <= ListView.view.currentIndex + 1) || gracePeriodRunning
35+ property bool gracePeriodRunning: false
36 width: ListView.view.width
37 height: ListView.view.height
38 asynchronous: true
39@@ -139,6 +141,24 @@
40 }
41 }
42 }
43+ Connections {
44+ target: dashContentList
45+ onCurrentIndexChanged: {
46+ if (dashContentList.currentIndex == index) {
47+ gracePeriodRunning = true;
48+ } else if (gracePeriodRunning) {
49+ unloadTimer.restart();
50+ }
51+ }
52+ }
53+ Timer {
54+ id: unloadTimer
55+ interval: 1000
56+ repeat: false
57+ onTriggered: {
58+ gracePeriodRunning = false;
59+ }
60+ }
61 }
62 }
63 }
64
65=== modified file 'Dash/GenericLensView.qml'
66--- Dash/GenericLensView.qml 2013-04-22 15:06:28 +0000
67+++ Dash/GenericLensView.qml 2013-05-15 14:52:28 +0000
68@@ -74,7 +74,7 @@
69 text: column_4 ? column_4 : "" // FIXME: this shouldn't be necessary
70 imageWidth: units.gu(11)
71 imageHeight: units.gu(16)
72- source: column_1 ? column_1 : "" // FIXME: ditto
73+ source: column_1 && visible ? column_1 : "" // FIXME: ditto
74 }
75 }
76 }
77
78=== modified file 'Dash/Music/AlbumTile.qml'
79--- Dash/Music/AlbumTile.qml 2013-02-15 15:08:28 +0000
80+++ Dash/Music/AlbumTile.qml 2013-05-15 14:52:28 +0000
81@@ -33,7 +33,7 @@
82 }
83 radius: "medium"
84 image: Image {
85- source: root.source
86+ source: icon.visible ? root.source : ""
87 sourceSize { width: icon.width; height: icon.height }
88 asynchronous: true
89 cache: false
90
91=== modified file 'Dash/Music/CarouselDelegateMusic.qml'
92--- Dash/Music/CarouselDelegateMusic.qml 2013-02-18 19:58:47 +0000
93+++ Dash/Music/CarouselDelegateMusic.qml 2013-05-15 14:52:28 +0000
94@@ -28,7 +28,7 @@
95 image: Image {
96 asynchronous: true
97 sourceSize { width: item.width; height: item.height }
98- source: model ? model.column_1 : ""
99+ source: model && item.visible ? model.column_1 : ""
100 }
101 }
102
103
104=== modified file 'Dash/People/CarouselDelegatePeople.qml'
105--- Dash/People/CarouselDelegatePeople.qml 2013-03-15 17:02:25 +0000
106+++ Dash/People/CarouselDelegatePeople.qml 2013-05-15 14:52:28 +0000
107@@ -31,7 +31,7 @@
108 image: Image {
109 asynchronous: true
110 sourceSize { width: item.width; height: item.height }
111- source: dataModel.avatar ? dataModel.avatar : ""
112+ source: dataModel.avatar && item.visible ? dataModel.avatar : ""
113 fillMode: Image.PreserveAspectCrop
114 }
115 }
116
117=== modified file 'Dash/People/Delegate.qml'
118--- Dash/People/Delegate.qml 2013-02-15 14:02:54 +0000
119+++ Dash/People/Delegate.qml 2013-05-15 14:52:28 +0000
120@@ -52,7 +52,7 @@
121 height: units.gu(6)
122 image: Image {
123 width: units.gu(6)
124- source: peopleView.dataModel.avatar
125+ source: avatar.visible ? peopleView.dataModel.avatar : ""
126 sourceSize { width: avatar.width; height: avatar.height }
127 fillMode: Image.PreserveAspectCrop
128 smooth: true
129
130=== modified file 'Dash/Video/CarouselDelegateVideo.qml'
131--- Dash/Video/CarouselDelegateVideo.qml 2013-02-18 19:58:47 +0000
132+++ Dash/Video/CarouselDelegateVideo.qml 2013-05-15 14:52:28 +0000
133@@ -28,7 +28,7 @@
134 image: Image {
135 asynchronous: true
136 sourceSize { width: item.width; height: item.height }
137- source: model ? model.column_1 : ""
138+ source: item.visible && model ? model.column_1 : ""
139 }
140 }
141
142
143=== modified file 'Dash/Video/VideosFilterGrid.qml'
144--- Dash/Video/VideosFilterGrid.qml 2013-05-08 13:29:13 +0000
145+++ Dash/Video/VideosFilterGrid.qml 2013-05-15 14:52:28 +0000
146@@ -40,7 +40,7 @@
147 text: model.column_4
148 imageWidth: filtergrid.iconWidth
149 imageHeight: filtergrid.iconHeight
150- source: model.column_1
151+ source: visible ? model.column_1 : ""
152 fillMode: Image.PreserveAspectCrop
153 onClicked: {
154 var fileUri = model.column_0.replace(/^[^:]+:/, "")

Subscribers

People subscribed via source and target branches