diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-04-19 20:09:22 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-04-23 03:00:31 +0200 |
commit | e76d27188ee11f1387d56b851dc73d83f093be48 (patch) | |
tree | a8471b933b032ac7f1fad091884219f8932713a6 | |
parent | 90c8dd41b94072f3712a0847553abb9b6b908697 (diff) |
wsd: use fast deflate level for png
The default deflate level of 6 is quite slow
and the benefits are hardly worth the high
latency that users experience.
Tested on a writer document with some small
images and a few pages of text:
Level 4 gives virtually identical compression
ratio to level 6, but is between 5-10% faster.
Level 3 runs almost twice as fast as level 6,
but the output is typically 2-3x larger.
Perhaps this should be exposed via config
so it would be possible to reduce latency
due to compression when CPU is scarce but
network bandwidth ample, and vice versa.
Change-Id: Iba88eea8f180d11458b33c68389e797234df1a60
Reviewed-on: https://gerrit.libreoffice.org/71018
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r-- | common/Png.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/Png.hpp b/common/Png.hpp index 1cd03f085..d4e1c2cf5 100644 --- a/common/Png.hpp +++ b/common/Png.hpp @@ -136,6 +136,12 @@ bool encodeSubBufferToPNG(unsigned char* pixmap, size_t startX, size_t startY, #if MOBILEAPP png_set_compression_level(png_ptr, Z_BEST_SPEED); +#else + // Level 4 gives virtually identical compression + // ratio to level 6, but is between 5-10% faster. + // Level 3 runs almost twice as fast, but the + // output is typically 2-3x larger. + png_set_compression_level(png_ptr, 4); #endif #ifdef IOS |