Skip to content

glib/gvariant: avoid g_renew() for definite tuples

If you have a definite-tuple type such as (iiii) then the number of children that are allocated will match the offset when a GVariantBuilder has completed.

That means we can avoid an expensive call into the allocator which is normally done to shrink memory use by releasing it back to the allocator.

This saves about 5% of wallclock time when building such variants in a tight loop.

Merge request reports