Skip to content

Speed up label escaping #800

Description

@jdmarshall

On the back of #798, there is now an opportunity to escape label names once at insert time rather than on every metrics call.

The metrics call is a high priority target for both time and space improvements. When I first came to the project, it was the most common complaint in the issue backlog. We have managed to speed up everything but this part. Collection is ~20% faster, aggregation 2.4x faster, but metrics are only a couple % faster.

With the introduction of #insert, we should be able to move the escapeString() call to insert. This could be done two ways:

  1. change the labels to only be escaped labels
  2. store the escaped form of the labels beside the original form

Number 2 may be more compatible, and since most strings do not need to be escaped in the first place, represent only a small increase in memory usage.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions