Commit 22c0866 for zlib

commit 22c0866f265d5a20a4d7a30cf4fbe9a49448afe3
Author: icodywu <125686483+icodywu@users.noreply.github.com>
Date:   Thu Nov 19 10:20:03 2026 -0800

    Speed up inflate by increasing its decoding table root sizes.

    Increase the root table sizes, from 9 to 10 for literal/length
    codes, and 6 to 8 for distance codes. This is a better balance of
    fewer second lookups against larger table builds on modern
    machines. This increases the size of the inflate state by 1152
    bytes.

diff --git a/infback.c b/infback.c
index ac96ba1..fe3d01c 100644
--- a/infback.c
+++ b/infback.c
@@ -393,12 +393,10 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc,
                 break;
             }

-            /* build code tables -- note: do not change the lenbits or distbits
-               values here (9 and 6) without reading the comments in inftrees.h
-               concerning the ENOUGH constants, which depend on those values */
+            /* build code tables */
             state->next = state->codes;
             state->lencode = (code const FAR *)(state->next);
-            state->lenbits = 9;
+            state->lenbits = LENBITS;
             ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
                                 &(state->lenbits), state->work);
             if (ret) {
@@ -407,7 +405,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc,
                 break;
             }
             state->distcode = (code const FAR *)(state->next);
-            state->distbits = 6;
+            state->distbits = DISTBITS;
             ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
                             &(state->next), &(state->distbits), state->work);
             if (ret) {
diff --git a/inflate.c b/inflate.c
index 6669faf..787810e 100644
--- a/inflate.c
+++ b/inflate.c
@@ -891,12 +891,10 @@ int ZEXPORT inflate(z_streamp strm, int flush) {
                 break;
             }

-            /* build code tables -- note: do not change the lenbits or distbits
-               values here (9 and 6) without reading the comments in inftrees.h
-               concerning the ENOUGH constants, which depend on those values */
+            /* build code tables */
             state->next = state->codes;
             state->lencode = (const code FAR *)(state->next);
-            state->lenbits = 9;
+            state->lenbits = LENBITS;
             ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
                                 &(state->lenbits), state->work);
             if (ret) {
@@ -905,7 +903,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) {
                 break;
             }
             state->distcode = (const code FAR *)(state->next);
-            state->distbits = 6;
+            state->distbits = DISTBITS;
             ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
                             &(state->next), &(state->distbits), state->work);
             if (ret) {
diff --git a/inftrees.h b/inftrees.h
index 20eb2c0..ede0f3c 100644
--- a/inftrees.h
+++ b/inftrees.h
@@ -35,24 +35,24 @@ typedef struct {
     01000000 - invalid code
  */

-/* Maximum size of the dynamic table.  The maximum number of code structures is
-   1444, which is the sum of 852 for literal/length codes and 592 for distance
-   codes.  These values were found by exhaustive searches using the program
-   examples/enough.c found in the zlib distribution.  The arguments to that
-   program are the number of symbols, the initial root table size, and the
-   maximum bit length of a code.  "enough 286 9 15" for literal/length codes
-   returns 852, and "enough 30 6 15" for distance codes returns 592. The
-   initial root table size (9 or 6) is found in the fifth argument of the
-   inflate_table() calls in inflate.c and infback.c.  If the root table size is
-   changed, then these maximum sizes would be need to be recalculated and
-   updated. */
+/* Maximum size of the dynamic table. The maximum number of code structures is
+   1732, which is the sum of 1332 for literal/length codes and 400 for distance
+   codes. These values were calculated using the program enough.c found in
+   examples in the zlib distribution. The arguments to that program are the
+   number of symbols, the initial root table size, and the maximum bit length
+   of a code. "enough 286 10 15" for literal/length codes returns 1332, and
+   "enough 30 8 15" for distance codes returns 400. The root table sizes (10
+   and 8) are defined here. If the root table sizes here are changed, then
+   these enough sizes must be recalculated and updated. */
+#define LENBITS 10
+#define DISTBITS 8
 #ifndef PKZIP_BUG_WORKAROUND
-#  define ENOUGH_LENS 852
-#  define ENOUGH_DISTS 592
+#  define ENOUGH_LENS 1332
+#  define ENOUGH_DISTS 400
 #else
 /* That workaround permits 288 literal/length codes and 32 distance codes. */
-#  define ENOUGH_LENS 854
-#  define ENOUGH_DISTS 594
+#  define ENOUGH_LENS 1334
+#  define ENOUGH_DISTS 402
 #endif
 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)