diff options
author | Terry Wilson <twilson@redhat.com> | 2021-11-05 09:13:34 -0500 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-11-30 01:24:00 +0100 |
commit | c041042c127c8ea846defd557e4c275b67f3d03d (patch) | |
tree | 20f037ff4d56e799aee0d7c464ce05c4633da01c /utilities | |
parent | 2fe20d0bed6288b1572e19bb7dc5113e23d8f955 (diff) | |
download | openvswitch-c041042c127c8ea846defd557e4c275b67f3d03d.tar.gz |
python: idl: Avoid pre-allocating column defaults.
Many python implementations pre-allocate space for multiple
objects in empty dicts and lists. Using a custom dict-like object
that only generates these objects when they are accessed can save
memory.
On a fairly pathological case where the DB has 1000 networks each
with 100 ports, with only 'name' fields set, this saves around
300MB of memory.
One could argue that if values are not going to change from their
defaults, then users should not be monitoring those columns, but
it's also probably good to not waste memory even if user code is
sub-optimal.
Signed-off-by: Terry Wilson <twilson@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Flavio Fernandes <flavio@flaviof.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'utilities')
0 files changed, 0 insertions, 0 deletions