Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/query: Use hash of labels instead of marshaling labels to json #3719

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

brancz
Copy link
Member

@brancz brancz commented Aug 30, 2023

Profiling data showed that:

  • building the sample label map
  • string interactions involved with dealing with keys/values
  • map accesses

Were quite expensive (10-15% CPU of flamegraph rendering).

xxhash3 is extremely fast (it's in a way replacing the json being built), and we'll no longer use strings for key/values anywhere, which is much faster to begin with. This does come with the veeeeeery small chance of a hash collision of label-sets. I'd happily see that happen though and then address it.

@alwaysmeticulous
Copy link

alwaysmeticulous bot commented Aug 30, 2023

✅ Meticulous spotted zero visual differences across 285 screens tested: view results.

Last updated for commit b98d6db. This comment will update as new commits are pushed.

Copy link
Member

@metalmatze metalmatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is only on the first level of the flame graph the chances for collisions seem indeed very low.

@brancz brancz merged commit ccf98e0 into main Aug 30, 2023
@metalmatze metalmatze deleted the labelhash branch August 30, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants