Pre-allocate buffers when adding string
We do a conservative estimate of the number of characters, but still, this limits the number of buffer reallocs to a small constant.
This commit is contained in:
parent
553bc3de82
commit
4e9ff1dd6e
|
@ -723,6 +723,7 @@ hb_buffer_guess_properties (hb_buffer_t *buffer)
|
||||||
} \
|
} \
|
||||||
if (item_length == -1) \
|
if (item_length == -1) \
|
||||||
item_length = text_length - item_offset; \
|
item_length = text_length - item_offset; \
|
||||||
|
buffer->ensure (buffer->len + item_length * sizeof (T) / 4); \
|
||||||
const T *next = (const T *) text + item_offset; \
|
const T *next = (const T *) text + item_offset; \
|
||||||
const T *end = next + item_length; \
|
const T *end = next + item_length; \
|
||||||
while (next < end) { \
|
while (next < end) { \
|
||||||
|
|
Loading…
Reference in New Issue