Closed
Bug 944224
Opened 12 years ago
Closed 12 years ago
Considerable amounts of images as dataURLs
Categories
(Firefox OS Graveyard :: Gaia, defect, P1)
Tracking
(blocking-b2g:1.3+, b2g-v1.3 fixed, b2g-v1.3T fixed)
RESOLVED
FIXED
| blocking-b2g | 1.3+ |
People
(Reporter: laszio.bugzilla, Assigned: cvan)
References
Details
(Whiteboard: [~660KB])
Attachments
(2 files, 1 obsolete file)
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.
Comment 1•12 years ago
|
||
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
| Assignee | ||
Comment 2•12 years ago
|
||
(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
Comment 3•12 years ago
|
||
(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)
Comment 4•12 years ago
|
||
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)
Comment 5•12 years ago
|
||
Is the markeplace a preloaded hosted app? Could we insert the image into the preloaded apps db?
Comment 6•12 years ago
|
||
markplace is a packaged app so it should be okay if use icon path in update.webapp.
Comment 7•12 years ago
|
||
(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 | ||
Updated•12 years ago
|
Assignee: nobody → cvan
Updated•12 years ago
|
Component: General → Consumer Pages
| Assignee | ||
Updated•12 years ago
|
Priority: -- → P3
Target Milestone: --- → 2013-12-10
Updated•12 years ago
|
Whiteboard: [tarako]
Comment 8•12 years ago
|
||
How about:
1. Load img with dataurl.
2. Copy image content.
3. And let GC sweep old image and dataurl.
Comment 9•12 years ago
|
||
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.
Comment 10•12 years ago
|
||
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.
Comment 11•12 years ago
|
||
(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?
Comment 12•12 years ago
|
||
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+
Comment 13•12 years ago
|
||
hi cvan, do you mind updating the bug so the latest status of this bug can be understood? thanks
Flags: needinfo?(cvan)
Updated•12 years ago
|
Whiteboard: [tarako] → [tarako][~660KB]
Comment 14•12 years ago
|
||
cvan, whats the status here? This was assigned to you over a month ago.
Comment 15•12 years 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)
Comment 16•12 years ago
|
||
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)
Comment 17•12 years ago
|
||
Fabrice, I think we should also hook up the OOM notification to purge the manifest cache.
Comment 18•12 years ago
|
||
(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)
Updated•12 years ago
|
Priority: P3 → P1
Updated•12 years ago
|
Target Milestone: 2013-12-10 → ---
Comment 19•12 years ago
|
||
(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)
Comment 20•12 years ago
|
||
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.
| Assignee | ||
Updated•12 years ago
|
Flags: needinfo?(cvan)
Target Milestone: --- → 2014-01-07
| Assignee | ||
Comment 21•12 years ago
|
||
| Assignee | ||
Comment 22•12 years ago
|
||
Attachment #8356332 -
Attachment is obsolete: true
Attachment #8356333 -
Flags: review?(fabrice)
Comment 23•12 years ago
|
||
Comment on attachment 8356333 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/15052
Thanks!
Attachment #8356333 -
Flags: review?(fabrice) → review+
Comment 24•12 years ago
|
||
Hi Will, Christopher's pull request use the right way to access images in packaged app.
Flags: needinfo?(yurenju.mozilla)
| Assignee | ||
Comment 25•12 years ago
|
||
Fabrice, can you please merge this in? I don't have commit privileges.
Comment 26•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 27•12 years ago
|
||
Needinfo jhford for the 1.3 uplift.
Flags: needinfo?(bwalker) → needinfo?(jhford)
Comment 28•12 years ago
|
||
[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)
Updated•12 years ago
|
Component: Consumer Pages → Gaia
Product: Marketplace → Firefox OS
Target Milestone: 2014-01-07 → ---
Version: Avenir → unspecified
Updated•12 years ago
|
status-b2g-v1.3:
--- → fixed
Comment 31•12 years ago
|
||
Actually, I can verify this bug is in v1.3t because it was merged to v1.3 before branching.
status-b2g-v1.3T:
--- → fixed
Comment 32•12 years ago
|
||
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.
Description
•