Skip to content

glib/gvariant: Avoid extraneous GBytes ref counting

Right now we create a bunch of GBytes which then get their reference count incremented and immediately decremented. This causes quite a bit of disruption for cacheline re-use.

Instead, this change creates an internal helper to transfer ownership of GBytes to the new GVariant directly.

Surprisingly, this reduced wallclock time by about 6% for a contrived benchmark of building G_VARIANT_TYPE ("as") variant with GVariantBuilder.

This originally would conflict with !4296 (merged) but has been updated to include the changes there as well.

Edited by Philip Withnall

Merge request reports

Loading