[issue19219] speed up marshal.loads()

Antoine Pitrou report at bugs.python.org
Fri Oct 11 11:51:56 CEST 2013


Antoine Pitrou added the comment:

> This looks fine.  Can you quantify where the speedup comes from?

>From all changes, but mainly the ASCII special-casing and the new
buffering.

> Reading the code, I see we now maintain a small internal buffer in
> the file object, rather than using stack allocation at the call
> sites.  It is unclear to me how this saves memory, since the amount
> of memory copying should be the same.

No, memory copying is suppressed in many cases.

> Have you looked at providing a special opcode for a few other magic
> numbers?(We have that in our own custom marshal format)
> Some very common values are:
> empty tuple
> 0
> 1

It shouldn't be useful since marshal memoizes them anyway: only the
first appearance in a pyc file would benefit.

----------

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


More information about the Python-bugs-list mailing list