Message150894
| Author |
pitrou |
| Recipients |
kayhayen, pitrou |
| Date |
2012年01月08日.18:49:24 |
| SpamBayes Score |
0.0008820507 |
| Marked as misclassified |
No |
| Message-id |
<1326048565.45.0.0213523607706.issue13735@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I think the "premature" optimization comes down to that code:
"""
static int
put(Picklerobject *self, PyObject *ob)
{
if (Py_REFCNT(ob) < 2 || self->fast)
return 0;
return put2(self, ob);
}
"""
(put2() being the function which emits BINPUT)
When you unpickle a dict, its contents are created anew and therefore the refcount is 1 => next pickling avoids emitting a BINPUT. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年01月08日 18:49:25 | pitrou | set | recipients:
+ pitrou, kayhayen |
| 2012年01月08日 18:49:25 | pitrou | set | messageid: <1326048565.45.0.0213523607706.issue13735@psf.upfronthosting.co.za> |
| 2012年01月08日 18:49:24 | pitrou | link | issue13735 messages |
| 2012年01月08日 18:49:24 | pitrou | create |
|