From 2e928d16a68db5c60934db80b3b8ac94907ec065 Mon Sep 17 00:00:00 2001 From: Hans Kristian Rosbach Date: Sat, 12 Jul 2025 12:48:10 +0200 Subject: [PATCH] Revert "Inserting strings is not slow any longer, remove bypass in deflate_medium()." This reverts commit 322753f36e833343ae030e499564691da15eef32. --- deflate_medium.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deflate_medium.c b/deflate_medium.c index ca334e4b..ae7c737e 100644 --- a/deflate_medium.c +++ b/deflate_medium.c @@ -63,8 +63,10 @@ static void insert_match(deflate_state *s, struct match match) { return; } - /* Insert new strings in the hash table. */ - if (s->lookahead >= WANT_MIN_MATCH) { + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + if (match.match_length <= 16 * s->max_insert_length && s->lookahead >= WANT_MIN_MATCH) { match.match_length--; /* string at strstart already in table */ match.strstart++; -- 2.47.3