[issue36466] Adding a way to strip annotations from compiled bytecode

Raymond Hettinger report at bugs.python.org
Sun Mar 31 18:23:25 EDT 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Here are some quick measurements on a single module¹ that uses typing. It shows about a 7% space savings between the baseline and patched versions:

  -rw-r--r--  1 raymond  staff  3490 Mar 31 15:07 kmeans.cpython-38.opt-2.pyc
  -rw-r--r--  1 raymond  staff  3245 Mar 31 15:10 kmeans.cpython-38.opt-2.pyc

Since unique types are singletons, the savings will likely be much less on bigger modules where the same types are used over and over again in the signatures:

    >>> List[int] is List[int]
    True

It would be nice if someone could measure the effect on a big project. It's possible that the benefits are negligible compared the savings from docstrings.

¹ https://raw.githubusercontent.com/rhettinger/modernpython/master/kmeans.py

----------

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


More information about the Python-bugs-list mailing list