tag/Item: declare value[] to have only one element
By declaring the variable-length array to have a nominal size of 1, struct TagPoolSlot shrinks from 24 bytes to 16 bytes, because "ref" and "item" now both fit in one machine word.
This commit is contained in:
parent
06682bd2a9
commit
9c1c180ae0
|
@ -34,13 +34,14 @@ struct TagItem {
|
|||
/**
|
||||
* the value of this tag; this is a variable length string
|
||||
*/
|
||||
char value[sizeof(long) - sizeof(type)];
|
||||
char value[1];
|
||||
|
||||
TagItem() = default;
|
||||
TagItem(const TagItem &other) = delete;
|
||||
TagItem &operator=(const TagItem &other) = delete;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TagItem) == 2, "Unexpected size");
|
||||
static_assert(alignof(TagItem) == 1, "Unexpected alignment");
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue