Try to reduce the memory foot print of the C implementation by:
Removing network and prefix from the struct keeping representing a node. Both are of type char[256] and it can take a bit of memory when have a lot of elements.
Setting the data attribute to NULL by default and make it read-wrtie. An empty python dict takes 240 bytes. This is a lot. It is now possible to store any type of value in data.
To not break the prefixes() method the prefixes are now calculated from the packed value, the family and the prefix length on the fly.
I decided to keep family and prefixlen in the struct so we can recreate ranges from the python side:
Coverage remained the same at 90.33% when pulling 2a5666518653a96c2174660d27b88090cc9b60c2 on SEKOIA-IO:feat/reduce_memory_footprint into 52d70b050a1dcbf3a7849aa51b2420883e31539e on mjschultz:master.
Try to reduce the memory foot print of the C implementation by:
network
andprefix
from the struct keeping representing a node. Both are of typechar[256]
and it can take a bit of memory when have a lot of elements.data
attribute toNULL
by default and make it read-wrtie. An empty python dict takes 240 bytes. This is a lot. It is now possible to store any type of value indata
.To not break the
prefixes()
method the prefixes are now calculated from the packed value, the family and the prefix length on the fly.I decided to keep
family
andprefixlen
in the struct so we can recreate ranges from the python side: