Message380061
@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. |
|
Date |
User |
Action |
Args |
2020-10-31 13:08:27 | methane | set | recipients:
+ methane, Mark.Shannon, serhiy.storchaka |
2020-10-31 13:08:27 | methane | set | messageid: <1604149707.31.0.664792430057.issue42217@roundup.psfhosted.org> |
2020-10-31 13:08:27 | methane | link | issue42217 messages |
2020-10-31 13:08:27 | methane | create | |
|