[issue20416] Marshal: special case int and float, don't use references

Martin v. Löwis report at bugs.python.org
Tue Jan 28 12:35:30 CET 2014


Martin v. Löwis added the comment:

For the record, format 3 was added through issue16475, format 4 was added through issue19219.

In msg175962, Kristjan argued that there is no reason _not_ to share int objects, e.g. across multiple code objects. Now it seems that this argument is flawed: there is a reason, namely the performance impact.

OTOH, I consider both use case (marshaling a large number of integers, and desiring to share ints across code objects) equally obscure: you shouldn't worry about marshal performance too much if you have loads of tiny int objects, and you shouldn't worry whether these ints get shared or not.

As a compromise, we could suppress the sharing for small int objects, since they are singletons, anyway. This would allow marshal to preserve/copy the object graph, while not impacting the use case that the original poster on python-dev presented.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20416>
_______________________________________


More information about the Python-bugs-list mailing list