[issue45152] Prepare for splitting LOAD_CONST into several opcodes

Serhiy Storchaka report at bugs.python.org
Fri Sep 10 03:45:36 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

>From my experience, the largest cost in importing module (after I/O) is for creating classes, especially classes with complex creation code: enums and dataclasses (and namedtuples in past, but they were significanly optimized since).

For I/O, would using zipimport or any other container help? It should reduce the number of stats and opens and allow to use compression.

As for increasing performance of demarshallization, it is already very fast (all is read from memory buffers, all repeated objects are cached). Switching to "wordcode" (32- or 64- bit instructions) and aligning all objects at the boundary of 4-8 bytes can marginally increase decoding speed, but it needs testing. Also more optimal using of references (like pickletools.optimize()) can reduce unmarshalling time at the cost of increasing marshalling time and memory consumption. It can also help with deterministic marshalling.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45152>
_______________________________________


More information about the Python-bugs-list mailing list