[spambayes-dev] improving dumbdbm's survival chances...
richie at entrian.com
Tue Jul 15 22:12:16 EDT 2003
> Maybe I'm missing something: why do you feel we *need* to use binary
> pickles (protocol 1 pickles, in current terminology)? Text pickles
> (protocol 0 pickles, in current terminology) work fine. Protocol 1 pickles
> are probably smaller (given how spambayes uses them), but that's it. In
> Python 2.3, protocol 2 pickles would be smaller still (because proto 2 adds
> a dedicated opcode for building 2-tuples, of which spambayes uses a ton --
> all but one value in the database), but the code as-is will still force
> spambayes to use proto 1.
Binary pickles are smaller and faster than text pickles - see
protocol 2 wasn't even a twinkle in Guido's eye at the time.
(Tim, you can't have been paying attention at the time because I even
offered up the offending code for review, in case anyone objected strongly
enough to reject it!)
> We use such a small subset of Shelf's functionality that it may be easier
> overall to implement the bit we need directly than to bother subclassing it.
That's probably the 'right' fix I was looking for. 8-)
> > 2.3's new writeback feature would have quietly failed
> I don't understand: AFAICT, spambayes doesn't use writeback (and has no use
> for it -- none of the spambayes database values are mutable). If that's so,
> how could writeback fail?
It can't currently. But in just the same way as my offensive code could
break someone else's, because it changes the way shelve works, so breaking
writeback could break someone else's (future) code that used our subclass.
But the scope of the breakage is a lot smaller - that's probably how I
should have done it. At least it could have had a wonking great "STOLEN
FROM 2.2" comment on it.
> passing -1 uses the most efficient pickle
> format the Python version supports (proto 1 in 2.2, proto 2 in 2.3).
Yow... I just wrote that that wasn't true in 2.2... now I see it was, but
only by a sick and twisted fluke. Let me rephrase: "That wasn't
documented behaviour for 2.2" 8-)
richie at entrian.com
More information about the spambayes-dev