Skip to content

Reduce heap churn when parsing XML #244

Description

@omc8db

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions