Feature suggestion: Shrink arrays
julianhartmer opened this issue · comments
What do you think about automatic shrinking of c-vectors? Currently, the vector capacity doubles when capacity == size
. How about cutting the vector capacity in half when the (size >> 2) < capacity
? This way, the capacity is cut in half when only a fourth of the capacity is used. I could make this feature optional by enabling it when CVECTOR_SHRINK
is defined. What are your thoughts?
I'm open to it, especially if controlled by a macro so it's opt in. I'd also be even more in favor of a cvector_shrink_to_fit
macro of some kind that would resize the vector to be an exact fit when the user wants it so.