gtkbuilder: Eliminate array reallocations in get_parameters()
gtk_builder_get_parameters() is a hot path, being called twice for
each object in each UI file in an application. The majority of objects
have ≤ 8 properties, which are each filtered into either
Unfortunately, both of those arrays are created as empty
adding 8 elements to an empty
GArray hits the worst possible case of
memcpy()ing the array 3 times. As the array size is
doubled with each reallocation, the cost is not particularly well
amortised when the array size is small.
ObjectInfo, we actually know how many properties there are in
total, so just allocate the arrays at the right size to begin with.
This saves 7% of the instruction cycles needed to start up
gnome-software to the point where it’s showing its main window,
according to callgrind. gnome-software is making around 5500 calls to
Signed-off-by: Philip Withnall email@example.com