[gs-code-review] CET 20-01-01 Adobe way of growing the dictionary
Alex Cherepanov
alexcher at quadnet.net
Sun Feb 18 07:26:17 PST 2007
Reproduce the algorithm used by Adobe to grow the dictionary
to match CET 20-01-01.
DIFFERENCES:
None: no comparefiles or CET differences.
The main question for the reviewer: do we need this adjustment
at all ?
-------------- next part --------------
Index: gs/src/idict.c
===================================================================
--- gs/src/idict.c (revision 7709)
+++ gs/src/idict.c (working copy)
@@ -790,8 +790,14 @@
dict *pdict = pdref->value.pdict;
/* We might have maxlength < npairs, if */
/* dict_round_size increased the size. */
- ulong new_size = (ulong) d_maxlength(pdict) * 3 / 2 + 2;
-
+ ulong new_size = (ulong) d_maxlength(pdict);
+ /* Adobe does this */
+ if (new_size < 20)
+ new_size += 10;
+ else if (new_size < 200)
+ new_size *= 2;
+ else
+ new_size += new_size / 2;
#if arch_sizeof_int < arch_sizeof_long
if (new_size > max_uint)
new_size = max_uint;
More information about the gs-code-review
mailing list