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
In pydantic v1, replacing each instantiated object's __dict__ with a dict of validated values used to broke PEP 412 (use of shared dictionary keys), which probably explains a part of the excessive memory usage of V1 when a lot of objects of same type were created.
This may be a concern still in v2, if I read rows like this correctly:
I have no adequate rust skills to test this, but it could be beneficial to study how shared keys affect memory consumption of objects validated by pydantic, and could updating __dict__ instead of replacing result in a smaller memory footprint.
More about shared keys, I hope that this is still relevant:
In pydantic v1, replacing each instantiated object's
__dict__with a dict of validated values used to brokePEP 412 (use of shared dictionary keys), which probably explains a part of the excessive memory usage of V1 when a lot of objects of same type were created.
This may be a concern still in v2, if I read rows like this correctly:
I have no adequate rust skills to test this, but it could be beneficial to study how shared keys affect memory consumption of objects validated by pydantic, and could updating
__dict__instead of replacing result in a smaller memory footprint.More about shared keys, I hope that this is still relevant:
Internals of sets and dicts