Closed
Bug 1137016
Opened 11 years ago
Closed 2 years ago
Speed up the PNG encoder by using a lower zlib compression level
Categories
(Core :: Graphics: ImageLib, enhancement)
Core
Graphics: ImageLib
Tracking
()
RESOLVED
DUPLICATE
of bug 1724331
People
(Reporter: glennrp+bmo, Unassigned)
References
Details
(Keywords: perf)
Attachments
(1 file)
|
2.04 KB,
patch
|
Details | Diff | Splinter Review |
This is a spinoff of bug #1132081. The PNG encoder (image/encoders/png/nsPNGEncoder.cpp) uses the default zlib compression level. By switching to a lower level such as 4 we can save about 10 milliseconds per 640x300 image that is encoded. This mainly occurs when thumbnails of web pages are collected for later use as menu items when a new tab is opened. It's only a one-line addition to nsPNGEncoder.cpp, but some reference tests would need to be updated too (which is why this change was dropped from bug #1132081).
| Reporter | ||
Updated•11 years ago
|
| Reporter | ||
Comment 1•11 years ago
|
||
Part 01 is the changes to code in nsPNGEncoder.cpp and media/libpng/pnglibconf.h,
OK to build now but some tests will fail.
Part 02 will contain updated tests.
| Reporter | ||
Comment 2•11 years ago
|
||
Pngcrush results with 26 cached thumbnails found in $HOME/.cache/mozilla/firefox/*/thumbnails indicate that level 4 is a good tradeoff between time and filesize. Command was pngcrush -force -m 1 -f 0 -l $L -e _test.png *.png
zlib encode total
level time bytes
1 0.638 1991606
2 0.660 1946166
3 0.719 1904228
4 0.965 1779118
5 1.075 1758058
6 1.333 1726207
7 1.592 1719363
Another 150k or so can be saved by storing them as RGB (PNG24) instead of RGBA (PNG32) images, but that's for another bug.
| Reporter | ||
Comment 3•11 years ago
|
||
For completeness I should have included the level 0 (uncompressed) result:
0 0.667 23976550
It's slower than levels 1 and 2 because of the extra IO time expended in writing
24 megabytes of output instead of less than 2 megabytes.
Comment 4•4 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.
Assignee: glennrp+bmo → nobody
Status: ASSIGNED → NEW
Updated•3 years ago
|
Severity: normal → S3
Comment 5•2 years ago
|
||
I didn't know this bug existed. We ended up doing something similar in bug 1724331.
You need to log in
before you can comment on or make changes to this bug.
Description
•