Derived from https://gitlab.gnome.org/GNOME/gnome-software/-/issues/941
libxmlb parses an xml with a two-step process. First it reads the data and turns it into a temporary in-memory tree of XML nodes, then it traverses the tree and serializes it to the compact representation.
The temporary nodes are all heap allocated, so this introduces a lot of heap churn. A profile of gnome-software showed XML parsing with libxmlb was the primary source of short-lived heap allocations triggering heap fragmentation.
The lifetime of these builder nodes is tightly scoped to the xb_builder_compile function call. Arena allocating builder nodes should improve performance and reduce impact to other users of the heap.
Derived from https://gitlab.gnome.org/GNOME/gnome-software/-/issues/941
libxmlb parses an xml with a two-step process. First it reads the data and turns it into a temporary in-memory tree of XML nodes, then it traverses the tree and serializes it to the compact representation.
The temporary nodes are all heap allocated, so this introduces a lot of heap churn. A profile of gnome-software showed XML parsing with libxmlb was the primary source of short-lived heap allocations triggering heap fragmentation.
The lifetime of these builder nodes is tightly scoped to the
xb_builder_compilefunction call. Arena allocating builder nodes should improve performance and reduce impact to other users of the heap.