blist
blist copied to clipboard
Dynamically allocate space in the root node.
Right now, small lists allocate enough space for LIMIT children, even if only one or two are actually needed. For small lists (where the root is a leaf), the memory footprint is terrible compared to an array-based list. The root needs to be able to dynamically choose the number of children. However, it needs to be very careful because hitherto a root node has been treated as a subclass of a regular node. With this change, routines cannot assume that any node has space for LIMIT children.
I could use a union to give new meaning to unused fields (such as in the index extension area). For very small lists, some of the space in the "ext" area could be used to store items. I'm not sure if that's worth the effort, though.