python / cpython

The Python programming language
https://www.python.org
Other
63.55k stars 30.45k forks source link

`.pyc` files are larger than they need to be #99554

Closed brandtbucher closed 5 months ago

brandtbucher commented 2 years ago

Python 3.11 made .pyc files almost twice as large. There are two main reasons for this:

(Note that these effects compound each other, since longer bytecode means more location entries.)

However, there is low-hanging fruit for improving this situation in 3.12:

When both of these optimizations are applied, .pyc files become ~33% smaller than 3.11. This is only ~33% larger than 3.10, despite all of the rich new debugging information present.

Linked PRs

stonebig commented 1 year ago

as a remark, packing a directory of distros of about 600 same packages on windows:

hugovk commented 8 months ago

Triage: can this issue be closed or is there more to do?