[ovs-dev] [PATCH v2] python: idl: Avoid pre-allocating column defaults

Dumitru Ceara dceara at redhat.com
Fri Nov 5 15:34:08 UTC 2021

On 11/5/21 3:13 PM, Terry Wilson wrote:
> 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 at redhat.com>
> ---

Looks good to me, thanks!

Acked-by: Dumitru Ceara <dceara at redhat.com>

More information about the dev mailing list