[Python-Dev] Python startup time: String objects

Guido van Rossum guido at python.org
Thu Mar 25 08:48:56 EST 2004


> > But is this really where the time goes?  On my home box (~11K
> > pystones/second) I can allocate 12K strings in 17 msec.
> 
> I have now implemented this change, and it gives 2% speed-up for
> an empty source file. The change is at http://python.org/sf/923098.
> 
> > It seems that marshalling would have to become a two-pass thing,
> > unless you want to limit that dict/list to function scope, in which
> > case I'm not sure it'll make much of a difference.
> 
> It's actually simpler than that. Marshalling recursively marshals
> code objects that have already been created, and traverses them all.
> So a single dict/list is sufficient. The change is 60 lines in
> marshal.c

Ah, I misunderstood.  The dict/list isn't marshalled separartely; it
is built up during (un)marshalling.  Clever.  (Pickling does a similar
thing.)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list