Message365118
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.) |
|
Date |
User |
Action |
Args |
2020-03-26 23:03:00 | BTaskaya | set | recipients:
+ BTaskaya |
2020-03-26 23:03:00 | BTaskaya | set | messageid: <1585263780.04.0.43303586086.issue40080@roundup.psfhosted.org> |
2020-03-26 23:03:00 | BTaskaya | link | issue40080 messages |
2020-03-26 23:02:59 | BTaskaya | create | |
|