From: Ralph Corderoy Date: Tue, 25 Apr 2017 22:21:21 +0000 (+0100) Subject: sbr/vector.c: Embed initial vector storage in header struct. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/67733cd0356ecf398135fc3f2978aabcd6900783?hp=67733cd0356ecf398135fc3f2978aabcd6900783 sbr/vector.c: Embed initial vector storage in header struct. Instead of a malloc(3)'d struct bvector having a pointer to a separately malloc'd area for the bits in the normal case of the default initial size, have non-malloc'd storage in the struct itself, and set the pointer to that. It's two unsigned longs, which is less than the previous default of 256 bits for struct bvector, but still double the pre-bvector norm of one word on 32 and 64-bit architectures. This halves the mallocs needed to create a struct bvector in the common case, but does mean that embedded memory is wasted should it not be enough. That's probably an unusual case. It also means derefencing the pointer to the bits probably hits the same cache line. Have separate initial sizes for string and int vectors. ---