[ZODB-Dev] Re: [Zope] DateTime mess

Tim Peters tim at zope.com
Thu Dec 1 12:04:05 EST 2005


[Gary Poster]
> For some definition of "a lot of thought". :-)  The pickle for pytz.utc
> is now relatively small (though still adds a non-trivial percentage
> addition--30%ish?--to a naive datetime  IIRC).  That's as far as that bit
> goes.

A naïve datetime has an extraordinarily small state, though, so 30% isn't
much in absolute terms.  IIRC, we're talking dozen of bytes versus hundreds
of bytes for a Zope2 DateTime.DateTime.

Note that we have yet to use a new strategy for shrinking pickle sizes:  a
few years ago Python's pickle code grew support for "extension codes", a
registry of class/type names that _can_ be referenced by short (as short as
2 bytes) new pickle codes, instead of embedding the module and class name
into every pickle, over and over again.  I don't recall the exact numbers
numbers, but some years ago Jeremy analyzed a customer Data.fs, and
discovered that at least half of it consisted of repetitions of the string
"BTrees.OOBTree.OOBTree" ;-)  That's the kind of thing the "extension code"
pickle mechanism was intended to address; it's a simple and cheap
compression gimmick, but so far unused.



More information about the ZODB-Dev mailing list