summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdenilson Cavalcanti <adenilson.cavalcanti@arm.com>2019-08-08 00:54:23 +0000
committerCommit Bot <commit-bot@chromium.org>2019-08-08 00:54:23 +0000
commit0f820c1d7165ba79e0429eab8b55c76f2be7d440 (patch)
treee8764229b98ec69d3062fd17da4b88dc6a20b300
parent5cb718c7fcd502ab38c38ed0cebe5fdf3cdd3a47 (diff)
downloadzlib-0f820c1d7165ba79e0429eab8b55c76f2be7d440.tar.gz
Allow disabling Castagnoli compression optimization
Faster symbol hashing has a positive impact on data compression speed (around 20% on Intel and 36% on Arm Cortex big cores). A misfeature is that the generated compressed output will differ from vanilla zlib (even though it is still valid 'DEFLATE-d' content) and in some cases has slightly better compression ratio. We offer here a way to disable the optimization if there is the expectation that compressed content should match when compared to vanilla zlib. Bug: 990489 Change-Id: I910e140eb15dd334eb869b078f940581249a7e6d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1742297 Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org> Reviewed-by: Chris Blume <cblume@chromium.org> Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#685041} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 5b8477c39bb70cb1cbb8bbbc8149674fa65f1c91
-rw-r--r--deflate.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/deflate.c b/deflate.c
index 98da939..c950d6f 100644
--- a/deflate.c
+++ b/deflate.c
@@ -215,13 +215,23 @@ local INLINE Pos insert_string_c(deflate_state *const s, const Pos str)
local INLINE Pos insert_string(deflate_state *const s, const Pos str)
{
+/* String dictionary insertion: faster symbol hashing has a positive impact
+ * on data compression speeds (around 20% on Intel and 36% on ARM Cortex big
+ * cores).
+ * A misfeature is that the generated compressed output will differ from
+ * vanilla zlib (even though it is still valid 'DEFLATE-d' content).
+ *
+ * We offer here a way to disable the optimization if there is the expectation
+ * that compressed content should match when compared to vanilla zlib.
+ */
+#if !defined(CHROMIUM_ZLIB_NO_CASTAGNOLI)
#if defined(CRC32_ARMV8_CRC32)
if (arm_cpu_enable_crc32)
return insert_string_arm(s, str);
#endif
if (x86_cpu_enable_simd)
return insert_string_sse(s, str);
-
+#endif
return insert_string_c(s, str);
}