Re: CET 20-01-01 Adobe way of growing the dictionary |
Ray Johnston <[email protected]> Sun, 18 Feb 2007 09:41:18 -0800
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Alex, Did you happen to check if there was any performance difference (I don't expect anything significant) ? I see no reason not to switch to Adobe's method. It fixes a CET issue and doesn't seem like an unreasonable approach. Regards, Ray ------------------------------------------------------------------------ Alex Cherepanov wrote: > 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 ? > > ------------------------------------------------------------------------ > > 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; > > > ------------------------------------------------------------------------ > > _______________________________________________ > gs-code-review mailing list > [email protected] > http://www.ghostscript.com/mailman/listinfo/gs-code-review >