This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients Mark.Shannon, methane, serhiy.storchaka
Date 2020-10-31.13:08:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1604149707.31.0.664792430057.issue42217@roundup.psfhosted.org>
In-reply-to
Content
@Serhiy 

> Do you mean sharing values of co_code and co_lnotab between code objects of the same module?

Yes.

> How much memory does this save (in absolute and relative value)?

Maybe 1~3%, but I am not sure. I am more interested in reducing number of objects, because it will reduce import time.
Additionally, co_code is used while executing code. Unlike other cold data (e.g. docstring, annotations), sharing co_code will improve CPU cache utilization.

> Which functions have the same co_code?

For example,

```
# logging/__init__.py

    @property
    def manager(self):
        return self.logger.manager
...
    @property
    def name(self):
        return self.logger.name
```

Such simple functions are very common in OO-style code.

@Mark Shannon

Sure.
History
Date User Action Args
2020-10-31 13:08:27methanesetrecipients: + methane, Mark.Shannon, serhiy.storchaka
2020-10-31 13:08:27methanesetmessageid: <1604149707.31.0.664792430057.issue42217@roundup.psfhosted.org>
2020-10-31 13:08:27methanelinkissue42217 messages
2020-10-31 13:08:27methanecreate