New submission from Batuhan Taskaya <batuhanosmantask...@gmail.com>:
Just like docstrings, annotations do nothing at runtime for the majority of the time. We can just strip out them and gain as much as the docstring optimization in bytecode size on a fully annotated repo. For comparing these two optimizations, I calculated the bytecode weight (marshal dumped size of) of each optimization (with a similar implementation to the compiler but not exact) over a project which both rich in docstrings and annotations. Project: https://github.com/Instagram/LibCST $ python simple_tester.py LibCST Total bytes: 1820086 Total bytes after 629 docstrings (total length of 180333) removed: 1643315 Total bytes after 8859 type annotations removed: 1641594 (I've submitted the script I used to calculate these results.) ---------- components: Interpreter Core files: simple_tester.py messages: 365118 nosy: BTaskaya priority: normal severity: normal status: open title: Stripping annotations out as a new optimization mode type: enhancement versions: Python 3.9 Added file: https://bugs.python.org/file49004/simple_tester.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40080> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com