Closed Bug 944224 Opened 12 years ago Closed 12 years ago

Considerable amounts of images as dataURLs

Categories

(Firefox OS Graveyard :: Gaia, defect, P1)

All
Gonk (Firefox OS)
defect

Tracking

(blocking-b2g:1.3+, b2g-v1.3 fixed, b2g-v1.3T fixed)

RESOLVED FIXED
blocking-b2g 1.3+
Tracking Status
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed

People

(Reporter: laszio.bugzilla, Assigned: cvan)

References

Details

(Whiteboard: [~660KB])

Attachments

(2 files, 1 obsolete file)

Attached file memory-reports —
The (various sizes of) icons of marketplace are encoded as dataURLs in external-apps/marketplace.firefox.com/update.webapp test_external_apps/marketplace.allizom.org/manifest.webapp test_external_apps/marketplace-dev.allizom.org/update.webapp There are more than 2MB runtime memory consumed and can't be collected. For example, 737,472 B (04.35%) -- string(length=28946, copies=12, "data:image/png;base64,iVBORw0KG... Please find the complete memory report attached for more details.
We need to switch to using direct icon assets. data URIs are known to consume far more memory than direct use of image assets.
Component: Gaia → General
Product: Firefox OS → Marketplace
Version: unspecified → Avenir
(In reply to Jason Smith [:jsmith] from comment #1) > We need to switch to using direct icon assets. data URIs are known to > consume far more memory than direct use of image assets. Can we easily do that we apps in `external-apps` directory? That is, how do we link to images on the file system? Once installed, the packaged app that gets updated links to images in the packaged app: https://github.com/mozilla/fireplace/blob/master/yulelog/manifest.webapp#L15-L21
(In reply to Christopher Van Wiemeersch [:cvan] from comment #2) > (In reply to Jason Smith [:jsmith] from comment #1) > > We need to switch to using direct icon assets. data URIs are known to > > consume far more memory than direct use of image assets. > > Can we easily do that we apps in `external-apps` directory? That is, how do > we link to images on the file system? > > Once installed, the packaged app that gets updated links to images in the > packaged app: > > https://github.com/mozilla/fireplace/blob/master/yulelog/manifest.webapp#L15- > L21 Yuren - Do you know? How can we reference direct image assets in the update.webapp in the external apps directory?
Flags: needinfo?(yurenju.mozilla)
for packaged app, yes we can. but for hosted app, it would be better if we use dataurl for preloading app because we need show icon even user can't access internet.
Flags: needinfo?(yurenju.mozilla)
Is the markeplace a preloaded hosted app? Could we insert the image into the preloaded apps db?
markplace is a packaged app so it should be okay if use icon path in update.webapp.
(In reply to Kan-Ru Chen [:kanru] from comment #5) > Is the markeplace a preloaded hosted app? Could we insert the image into the > preloaded apps db? We still need to address the preloaded hosted app use case, maybe in another bug.
Assignee: nobody → cvan
Component: General → Consumer Pages
Priority: -- → P3
Target Milestone: --- → 2013-12-10
Whiteboard: [tarako]
Blocks: 128RAM
blocking-b2g: --- → 1.3?
How about: 1. Load img with dataurl. 2. Copy image content. 3. And let GC sweep old image and dataurl.
Better idea: 1. Convert dataurl to TypedArray (data) 2. blob = new Blob([data]) 3. url = URL.createObjectURL(blob) 4. image.src = url Still it would probably takea only ~20% less memory.
Note that these are JS strings, so base64 means storing 6 bits in a 16-bit character. Also, the copies=12 in comment #0 is a source of concern — it looks like we could save 660 KiB just by not having the 11 extra copies.
(In reply to Jed Davis [:jld] from comment #10) > Note that these are JS strings, so base64 means storing 6 bits in a 16-bit > character. Also, the copies=12 in comment #0 is a source of concern — it > looks like we could save 660 KiB just by not having the 11 extra copies. In first step I meant decoding base64 to bytes array (Uint8Array). Of course it doesn't resolve problem of extra copies. BTW, why JS engine doesn't share identical strings?
triage: 1.3+ to benefit tarako. unless after review we believe this is too risky to uplift then we can discuss further
blocking-b2g: 1.3? → 1.3+
hi cvan, do you mind updating the bug so the latest status of this bug can be understood? thanks
Flags: needinfo?(cvan)
Whiteboard: [tarako] → [tarako][~660KB]
cvan, whats the status here? This was assigned to you over a month ago.
bwalker, can you please make this a top priority. This is a huge memory hog and I am not seeing progress in this bug despite multiple needinfos.
Flags: needinfo?(bwalker)
fabrice, should we add a setter in the app code to automatically parse and turn into a blob any data urls and when you use the getter we turn int back into a data url. That would work around anyone else doing this insanity with data urls.
Flags: needinfo?(fabrice)
Fabrice, I think we should also hook up the OOM notification to purge the manifest cache.
(In reply to Jason Smith [:jsmith] from comment #3) > (In reply to Christopher Van Wiemeersch [:cvan] from comment #2) > > Can we easily do that we apps in `external-apps` directory? That is, how do > > we link to images on the file system? > Yuren - Do you know? How can we reference direct image assets in the > update.webapp in the external apps directory? (In reply to Yuren Ju [:yurenju] from comment #4) > for packaged app, yes we can. but for hosted app, it would be better if we > use dataurl for preloading app because we need show icon even user can't > access internet. Can you expand on the method of doing this? I think you're saying it's possible but we don't know the details. The Marketplace is a packaged app. Thanks
Flags: needinfo?(yurenju.mozilla)
Priority: P3 → P1
Target Milestone: 2013-12-10 → ---
(In reply to Andreas Gal :gal from comment #16) > fabrice, should we add a setter in the app code to automatically parse and > turn into a blob any data urls and when you use the getter we turn int back > into a data url. That would work around anyone else doing this insanity with > data urls. I'd like to keep them urls, so I'll try to turn them into blob uris. The tricky part is that blob uris are bound to a window. (In reply to Andreas Gal :gal from comment #17) > Fabrice, I think we should also hook up the OOM notification to purge the > manifest cache. Yes, good catch. Big wins with this one in bug 956833
Flags: needinfo?(fabrice)
As long we flush the cache we might not need to fiddle with this at the gaia level too much. But the marketplace folks should definitely stop doing this since they are on every home screen.
Flags: needinfo?(cvan)
Target Milestone: --- → 2014-01-07
Attachment #8356332 - Attachment is obsolete: true
Attachment #8356333 - Flags: review?(fabrice)
Hi Will, Christopher's pull request use the right way to access images in packaged app.
Flags: needinfo?(yurenju.mozilla)
Fabrice, can you please merge this in? I don't have commit privileges.
Needinfo jhford for the 1.3 uplift.
Flags: needinfo?(bwalker) → needinfo?(jhford)
[v1.3 482cff8] Merge pull request #15052 from cvan/mkt-icons I can't seem to find the status flag on this bug :/
Flags: needinfo?(jhford)
Component: Consumer Pages → Gaia
Product: Marketplace → Firefox OS
Target Milestone: 2014-01-07 → ---
Version: Avenir → unspecified
Tim, can you uplift on 1.3t? thanks!
Flags: needinfo?(timdream)
This is a 1.3+ bug.
Flags: needinfo?(timdream)
Actually, I can verify this bug is in v1.3t because it was merged to v1.3 before branching.
status-b2g-v1.3T: fixed. remove tarako
Whiteboard: [tarako][~660KB] → [~660KB]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: