[Python-Dev] Re: [Python-checkins] python/dist/src/Python compile.c, 2.311, 2.312

Michael Hudson mwh at python.net
Tue Aug 3 18:01:18 CEST 2004


"Martin v. Löwis" <martin at v.loewis.de> writes:

> Guido van Rossum wrote:
>> Aha!  So maybe we should reconsider whether mwh's removal of the
>> filename interning in the compiler should be reverted.
>
> I just looked at the sizes of the four largest .pyc files wrt. to this
> change (ie. the one generated before 2.312, and the one generated
> after):
>
>                   before            after
> pydoc            84711             91263
> cookielib        57353             57353
> pickletools      55862             57038
> tarfile          54074             58974
>
> So the patch does cause a size increase (and likely also a slowdown
> because of the extra memory allocations at startup). Whether this is
> relevant or not, I don't know.

Me neither.  Are you sure you regenerated cookielib?

What would it cost to check if all strings could be stored via
TYPE_STRINGREF?  (Almost nothing in code terms...)

> I think I would prefer if a different mechanism was found to account
> for the change in references during an import, e.g. by taking the
> number of interned strings before and after the import operation.

Well, this isn't about import, it's more about execfile.  I had
entirely failed to twig that interning the filename might save space
in the .pyc, so didn't see any downsides to this particular
workaround.  I'd be happy with any other (I mentioned not doing
refcounting on dictobject.c's dummy; maybe I should actually see if
that's possible :-).

Cheers,
mwh

-- 
  The gripping hand is really that there are morons everywhere, it's
  just that the Americon morons are funnier than average.
                              -- Pim van Riezen, alt.sysadmin.recovery


More information about the Python-Dev mailing list