Closed Bug 1029977 Opened 10 years ago Closed 10 years ago

Do not use data-uris for collection backgrounds

Categories

(Firefox OS Graveyard :: Gaia::Everything.me, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(blocking-b2g:2.0+, b2g-v2.0 fixed, b2g-v2.1 fixed)

RESOLVED FIXED
2.0 S6 (18july)
blocking-b2g 2.0+
Tracking Status
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed

People

(Reporter: jlal, Assigned: amirn)

References

Details

(Keywords: memory-footprint, perf, Whiteboard: [c=memory p= s=2014.07.18.t u=2.0] [MemShrink:P2][systemsfe][ETA=7/17])

Attachments

(2 files)

While debugging something else I noticed we are using data uris for the collections background image.... This has a number of performance problems and we should use blobs of images OR a straight source of an image if that is available.

This can have a significant memory impact.
Need to understand the depth of the memory impact here to make a blocking call.
Blocks: 1015336
No longer blocks: vertical-homescreen
QA Whiteboard: [VH-FL-blocking-][VH-FC-blocking?]
Keywords: footprint, perf
Whiteboard: [MemShrink]
James - Can you evaluate the memory impact here (i.e. how much memory is being used here)?
Flags: needinfo?(jlal)
OS: Mac OS X → Gonk (Firefox OS)
Priority: -- → P3
Hardware: x86 → ARM
Whiteboard: [MemShrink] → [MemShrink][c=memory p= s= u=]
Attached file memory-reports
Memory report attached... It is hard to tell what the difference would be using a bloc or src but we currently use at least 1.8mb for the datauri.
Flags: needinfo?(jlal)
Kyle - This might be one of the reasons why bug 1029902 is present. What's your take on a blocking decision on this bug from a MemShrink perspective? Do you need this fixed to help fix bug 1029902?
Flags: needinfo?(khuey)
This does not directly effect the memory of the homescreen this is allocated in the collections app (which unless I am mistaken) is not in the same process as the homescreen.
Flags: needinfo?(khuey)
The 1.8 MB is the image created from the data URI, not the URI string itself.  We should fix this, but it's probably a relatively minor (e.g. < 10%) part of bug 1029902.
Blocks: 1029902
blocking-b2g: --- → 2.0?
Also this memory is in the "Smart Collections" process and I have no idea what that is.  Is there a design doc somewhere I can read?
QA Whiteboard: [VH-FL-blocking-][VH-FC-blocking?] → [VH-FL-blocking-][VH-FC-blocking+]
Whiteboard: [MemShrink][c=memory p= s= u=] → [MemShrink][c=memory p= s= u=] [systemsfe]
blocking-b2g: 2.0? → 2.0+
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #7)
> Also this memory is in the "Smart Collections" process and I have no idea
> what that is.  Is there a design doc somewhere I can read?

No time for documentation this time around unfortunately, but basically we've split the homescreen and everything.me code up into different apps. The homescreen ships with a few "smart collections", and when you tap on one it will open an activity to view a smart collection. It's highly unlikely that this impacts bug 1029902, unless you were measuring with a smart collection open - so unblocking for now.

Also I just double checked and this is *exactly* what smart collections do in 1.4, so there shouldn't be much of a regression here.
No longer blocks: 1029902
Component: Gaia::Homescreen → Gaia::Everything.me
We should fix this, but I don't think it should block 2.0 as this is the exact same behavior as what we do in 1.4. Noming for 2.0? and suggesting that we don't block.
blocking-b2g: 2.0+ → 2.0?
Okay, I'll kick this out of the blocking queue if it's long-standing.
Blocks: vertical-home-next
No longer blocks: 1015336
blocking-b2g: 2.0? → backlog
QA Whiteboard: [VH-FL-blocking-][VH-FC-blocking+] → [VH-FL-blocking-][VH-FC-blocking-]
Whiteboard: [MemShrink][c=memory p= s= u=] [systemsfe] → [MemShrink:P2][c=memory p= s= u=] [systemsfe]
Assignee: nobody → amirn
(In reply to Kevin Grandon :kgrandon from comment #8)
> (In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #7)
> > Also this memory is in the "Smart Collections" process and I have no idea
> > what that is.  Is there a design doc somewhere I can read?
> 
> No time for documentation this time around unfortunately, but basically
> we've split the homescreen and everything.me code up into different apps.
> The homescreen ships with a few "smart collections", and when you tap on one
> it will open an activity to view a smart collection. It's highly unlikely
> that this impacts bug 1029902, unless you were measuring with a smart
> collection open - so unblocking for now.
> 
> Also I just double checked and this is *exactly* what smart collections do
> in 1.4, so there shouldn't be much of a regression here.
 
Sadly I did a measurement while the homescreen is starting up. At that point it seems that the base64 images are loaded both into the app window, but also into the the chrome scope.

It results into having the exact same amount of memory at the end, but it is two times biggers when the homescreen is starting up.
My current theory is that the base64 images are loaded once into the homescreen window, and once into the chrome scope by the datastore.
It means that when the homescreen is killed, it will consume 2 times more memory if the user has some collections on the homescreen...

Asking 2.0? again.
blocking-b2g: backlog → 2.0?
blocking-b2g: 2.0? → 2.0+
Target Milestone: --- → 2.0 S6 (18july)
what is the "gaia way" for converting base64 image to blob?
Depends on: 1039311
Attached file Pull Request
James, can you please run the memory profile again?
Attachment #8456938 - Flags: review?(kgrandon)
Attachment #8456938 - Flags: feedback?(jlal)
Comment on attachment 8456938 [details] [review]
Pull Request

f? on Vivien for memory profiling as well. thanks!
Attachment #8456938 - Flags: feedback?(21)
Priority: P3 → P1
Severity: normal → blocker
Whiteboard: [MemShrink:P2][c=memory p= s= u=] [systemsfe] → [MemShrink:P2][c=memory p= s= u=2.0] [systemsfe]
Comment on attachment 8456938 [details] [review]
Pull Request

I'm guessing this should be much better. We do still need to process the base64 encoded image to generate the blob, but I guess there's no real way around it - though it should be relatively rare that we do it since we have the CDN images now I think?

Anyway, the code seems fine so R+. Would prefer to have Vivien or someone measure the difference in memory usage before landing though.
Attachment #8456938 - Flags: review?(kgrandon) → review+
Whiteboard: [MemShrink:P2][c=memory p= s= u=2.0] [systemsfe] → [MemShrink:P2][c=memory p= s= u=2.0] [systemsfe][ETA=7/17]
Let's land and people can verify/measure that this is better. Thanks!

Master: https://github.com/mozilla-b2g/gaia/commit/a470c523d1f0d50c039f6a7e0326a06e2a4e7db3
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Needs rebasing for v2.0 uplift.
Flags: needinfo?(amirn)
looks like we have conflicts because bug 1016221 is not in v2.0.
updated dependency.
Depends on: 1016221
Flags: needinfo?(amirn)
Comment on attachment 8456938 [details] [review]
Pull Request

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): Using base64 image src
[User impact] if declined: Memory usage is high
[Testing completed]: Yes
[Risk to taking this patch] (and alternatives if risky): Low
[String changes made]: switched to using blobs instead
Attachment #8456938 - Flags: approval-gaia-v2.0?
Whiteboard: [MemShrink:P2][c=memory p= s= u=2.0] [systemsfe][ETA=7/17] → [c=memory p= s=2014.07.18.t u=2.0] [MemShrink:P2][systemsfe][ETA=7/17]
Attachment #8456938 - Flags: approval-gaia-v2.0?
Comment on attachment 8456938 [details] [review]
Pull Request

I guess this does not need my f? anymore.
Attachment #8456938 - Flags: feedback?(21)
clear ni
Attachment #8456938 - Flags: feedback?(jlal)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: