Closed jabdoa2 closed 5 years ago
Interesting... As I understood it, use of slots gives you a marginal performance and occupancy benefit. I hadn't done anything with it up to now as I didn't think it warranted the extra effort of synchronizing the list with the code to initialize it. What sort of gains did you get in making this change?
We get 3-4% of worst case CPU improvements from this. This mostly reduces the memory footprint of objects because they won't use a dict but a fixed position for the attributes. As a result access times are shorter. However, I guess in this case reduced memory footprint has the largest effect (because we create a lot of Labels). PYPY does this automatically but Python does not.
Issues fixed by this PR
None
What does this implement/fix?
Improve performance of widget creation in Python 3 by slotting widgets.