Speed up resetting of GString
There are a few places were a GString get's reused but uses g_string_set_size()
to 0
. This is a bit problematic performance-wise because g_string_set_size()
has to check if the new size is greater than the old size and possibly expand the size of the GString
.
However, g_string_truncate()
must always be <=
the current length and so there is an inlined version of g_string_truncate()
which will expand to basically:
str->str[len] = 0;
str->len = len;
I've been carrying this in my gsktextnode branch but it should just land on master.