[Gaia::Dialer] Ensure images are optimized

RESOLVED FIXED

Status

Firefox OS
Gaia::Dialer
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: kgrandon, Assigned: kgrandon)

Tracking

({perf})

unspecified
x86
Mac OS X
Bug Flags:
in-moztrap -

Firefox Tracking Flags

(blocking-b2g:tef+, b2g18+ fixed, b2g18-v1.0.1 fixed)

Details

(Whiteboard: [FFOS_perf] QARegressExclude)

Attachments

(2 attachments)

(Assignee)

Description

5 years ago
Verify that all images loaded for dialer are optimized, and don't have unneeded metadata. I've used tools like smushit (http://www.smushit.com/ysmush.it/) in the past, but there may be better tools now.

This is also likely something that we could do during the build process if we desired.
Whiteboard: [FFOS_perf]
Assignee: nobody → kgrandon
blocking-b2g: --- → tef?
Keywords: perf
A patch for this issue is available at

  https://github.com/tdz/gaia/commit/ffd6a95acf08383341219a392d148980cad6b689

I used 'optipng', a nice little tool for the Linux command line. It can strip all meta data and re-encode PNG files with minimal bit depth, maximum compression, etc. The resulting files are only 30-50% of the original one's.
Flags: needinfo?(kgrandon)
Created attachment 709723 [details]
File sizes of dialer PNGs, before vs. after

The file sizes of the dialer app's PNG files after running optipng. The .png.bak files are backups of the original files.
Created attachment 709727 [details]
File-size differences for all apps' PNGs

Just for fun, I re-encoded all app's PNG files. The file-size differences are in the attachment. I don't have any hard data, but the interface sometimes seems to load slightly faster now, for example the image in the FTU's language selection or the wallpapers in the wallpaper selector.

The patch is available at

  https://github.com/tdz/gaia/commit/c300798c7a32129978365cf84370e8d36c42ef27

if you're interested.

BTW: How do I attach a pointer to a pull request on github?
Optipng is available from

  http://optipng.sourceforge.net/

Comment 5

5 years ago
Let's get a patch ready and landed to v1.x before consider for v1.0.0. Please nominate for uplift once landed to master and ready.
tracking-firefox-esr17: --- → +
Kevin,

A pull request to gaia/master is pending at

  https://github.com/mozilla-b2g/gaia/pull/7970

Please review and merge, if appropriate.
(Assignee)

Comment 7

5 years ago
Ok, I will take a look Thomas. We generally make an attachment on this bug that points to the github pull request, but as this is only images it should be fine.

I also have a patch ready that replaces nearly every image on disk and shaves off around 2.5mb of image data. But I'd much rather use something in the build system. We do have a tool that handles it for us in tools/png_recompress.sh, but it's rather manual right now.
Flags: needinfo?(kgrandon)
(Assignee)

Comment 8

5 years ago
Landed: https://github.com/mozilla-b2g/gaia/commit/1b9cd0c3e71a904e086c19f2d5e1becb36154a51
Thanks for merging the patch.

We should be careful with automating PNG optimizations during builds. Bug 817112 indicates that not all PNG files are support by all components. And it also takes a very long time. When I ran the optimizer for all PNG files it took 15 minutes or more. I wouldn't want to invest this time during builds.

Another idea for automating the optimization is the use of git hooks on Gaia's server-side repository. Whenever someone pushes a PNG file into the repository, the committed file could automatically be optimized by the git-hook script.
status-b2g18: --- → affected
status-b2g18-v1.0.0: --- → affected
tracking-b2g18: --- → +
tracking-firefox-esr17: + → ---
(Assignee)

Comment 10

5 years ago
This is landed so marking as fixed. It's a tiny perf improvement, which I'm assuming we want. Do I change tef to leo then to get it into 1.x?
Status: NEW → RESOLVED
blocking-b2g: tef? → leo?
Last Resolved: 5 years ago
Resolution: --- → FIXED
This bug flew under my radar: we already have a script to recompress PNG files which uses a combination of optipng and advpng with brute-force default options, it can be found in gaia under tools/png_recompress.sh. Running it recursively on the apps/communication/dialer directory further shrunk the PNG files by ~6%.

It is obviously very slow so I'm not sure if it would be a good idea to invoke it at build time. It would be nice however to invoke it over all our PNG files just before release (perhaps before creating a new tag?). Last time I tried it shaved ~2MiB from all gaia apps.
Batch edit: Bugs still affected on b2g18 after 2/13 merge to v1.0.1 branch are affected on v1.0.1 branch.
status-b2g18-v1.0.1: --- → affected
I think this should be TEF+ if we want to have an impact in this release.  Doesn't seem like a significant regression risk.
blocking-b2g: leo? → tef?
Actual patch is in comments 8 / 6.
blocking-b2g: tef? → tef+
status-b2g18: affected → fixed
status-b2g18-v1.0.0: affected → ---
v1-train@3c010fc87726453a8677868f4f965ced33454a2a
v1.0.1@ca9439062e07fe32c6272714faee8aae72f6a1cb
status-b2g18-v1.0.1: affected → fixed

Updated

5 years ago
Whiteboard: [FFOS_perf] → [FFOS_perf] QARegressExclude

Comment 16

5 years ago
No Test case creation is needed in moztrap for this issue.
Flags: in-moztrap-

Comment 17

5 years ago
Cannot verify, need steps to blackbox test the issue.
You need to log in before you can comment on or make changes to this bug.