[New-bugs-announce] [issue40080] Stripping annotations out as a new optimization mode
Batuhan Taskaya
report at bugs.python.org
Thu Mar 26 19:03:00 EDT 2020
New submission from Batuhan Taskaya <batuhanosmantaskaya at 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 <report at bugs.python.org>
<https://bugs.python.org/issue40080>
_______________________________________
More information about the New-bugs-announce
mailing list