You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Effective key-sharing is important for memory use and performance of class instances. With #72 it will become even more important.
Unfortunately, there are a few patterns that interfere with key sharing, when we generate the set of keys dynamically.
Anecdotally, in real-world applications there are many classes where keys are not shared.
Building key sets dynamically will result in the set {'bar'}. Any objects that lazily update foo will be unable to share keys. By statically analyzing the class in the compiler, we can see that the set {'bar','foo'} would be a better choice.
Instances that do not define foo will waste a small amount of memory, but the overall saving from improved sharing would more than compensate.
To do:
Gather data on the number and kinds of classes where key sharing does not currently work well.
Discuss of Python Dev exactly when dictionary ordering should apply. Possibly write a PEP
Implement generating key hints in compiler and using them in class creation.
The text was updated successfully, but these errors were encountered:
Effective key-sharing is important for memory use and performance of class instances. With #72 it will become even more important.
Unfortunately, there are a few patterns that interfere with key sharing, when we generate the set of keys dynamically.
Anecdotally, in real-world applications there are many classes where keys are not shared.
E.g.
Building key sets dynamically will result in the set
{'bar'}
. Any objects that lazily updatefoo
will be unable to share keys. By statically analyzing the class in the compiler, we can see that the set{'bar','foo'}
would be a better choice.Instances that do not define
foo
will waste a small amount of memory, but the overall saving from improved sharing would more than compensate.To do:
The text was updated successfully, but these errors were encountered: