Jim Fulton wrote at 2006-10-9 15:04 -0400:
> ...
>> To make cache garbage collection as fast as possible,
>> I have proposed to actually store the sticky information in the
>> C object structure.
>I don't like the idea of adding that overhead to every
>persistent object just for this use case.  OTOH, we only
>need a bit and I think we had a few spare bits.  So maybe
>this wouldn't require any new space.

That's how I implemented it in our local Zope copy.

#define cPersistent_HEAD \
    PyObject_HEAD \
    PyObject *jar; \
    PyObject *oid; \
    PerCache *cache; \
    CPersistentRing ring; \
    char serial[8]; \
    signed char state; \
/* DM 2005-08-22: sticky support */ \
    /* unsigned char reserved[3]; */ \
    unsigned char sticky; /* we need only a bit; but byte access is cheaper */\
    unsigned char reserved[2];

As you can see, I used one of the three reserved "char"s -- and did not
increase the size of persistent objects.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to