Jim Fulton wrote:

On Nov 6, 2007, at 2:40 PM, Sidnei da Silva wrote:

Despite this change there are still a huge amount
of unexplained calls to the 'persistent_id' method of the ObjectWriter
in serialize.py.

Why 'unexplained'? 'persistent_id' is called from the Pickler instance
being used in ObjectWriter._dump(). It is called for each and every
single object reachable from the main object, due to the way Pickler
works (I believe). Maybe persistent_id can be analysed and optimized
for the most common cases?

Yup.

Note that there is a undocumented feature in cPickle that I added years ago to deal with this issue but never got around to pursuing. Maybe someone else would be able to spend the time to try it out and report back.

If you set inst_persistent_id, rather than persistent_id, on a pickler, then the hook will only be called for instances. This should eliminate that vast majority of the calls.

Note that this feature was added back when testing was minimal or non-existent, so it is untested, however, the implementation is simple enough. :)

Do you mean that the ZODB has enough tests now that making the change and running the tests might already be a good proof ?

Or should we be more prudent ?

If it would,

What do you mean by 'If it would' ?

then of course we should contribute documentation and a test to the Python source tree.

Jim

--
Jim Fulton
Zope Corporation


--
Godefroid Chapelle (aka __gotcha) http://bubblenet.be
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to