stw added the comment:
> So the tuple is linked-in to the garbage collection list before its
> contents are constructed?
> It is. It typically happens when you do (in C code):
Ok, thanks. I couldn't see how a tuple could be created before its contents in
python code, but
stw added the comment:
> I had a thought about untracking tuples. If a tuple contains only
> immutable objects (atomics and tuples of atomics etc), then it should
> be untracked. Once untracked, it will never need to be tracked again
> since the tuple is immutable. If a tuple cont
stw added the comment:
I had a thought about untracking tuples. If a tuple contains only immutable
objects (atomics and tuples of atomics etc), then it should be untracked. Once
untracked, it will never need to be tracked again since the tuple is immutable.
If a tuple contains mutable
stw added the comment:
> Probably because memoization itself uses a dict.
Right, but as far as I can tell it's not the memo dict that keeps being
tracked/untracked. Rather, it's the dict that is being unpickled.
Anyway, I suppose the point is that the issue of whether an objec
stw added the comment:
I'd come to the same conclusion - as the new dict is built up (using batch
build) it keeps appearing in generation 0, and the gc has to walk over it to
determine that it should be untracked.
However, this only seems to be true if the pickle file is created
stw added the comment:
One other thing - python 2.7 added the is_tracked function to the gc module. As
I understand it (from issue #4074) tuples of atomic types are supposed to be
untracked. However, in python 2.7:
>>> gc.is_tracked((1, 2))
True
>>> gc.is_tra
stw added the comment:
Thanks for the nod to the pickletools module. The structure of the streams do
change between python 2.6 and 2.7, at least for files created with cPickle. You
can see this from the file sizes that I quoted in my previous post. Below are
some snippets of the
Changes by stw :
Added file: http://bugs.python.org/file25525/load_file.py
___
Python tracker
<http://bugs.python.org/issue14775>
___
___
Python-bugs-list mailin
New submission from stw :
I've found that unpickling a certain kind of dictionary is substantially slower
in python 2.7 compared to python 2.6. The dictionary has keys that are tuples
of strings - a 1-tuple is enough to see the effect. The problem seems to be
caused by garbage collectio