Skip to content

MetadataTransfer: avoid an intermediate key set per wildcard for every outlink #2130

Description

@GGraziadei

MetadataTransfer.filter() is called for every outlink. For each wildcard key (e.g. cookie.*) it calls Metadata.keySet(prefix), which streams over all the metadata keys and collects a new Set, then copies each matching key through getValues()/setValues() with key normalisation on both sides.

That is one intermediate set per wildcard per outlink, plus repeated key normalisation, on the hottest path of the parser bolts.

Proposal: pre-compile the configured keys into exact keys and wildcard prefixes once, and copy the matching entries in a single pass over the metadata map.

Micro-benchmark on a 12-key metadata with 3 wildcards and 2 exact keys: ~780 ns to ~265 ns per outlink.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions