Skip to content

Conversation

rauhul
Copy link
Contributor

@rauhul rauhul commented Jul 30, 2021

  • Updates DimensionLabels' Equatable and Hashable conformances to avoid
    allocating unnecessary strings. Updates DimensionHistogramLabels and
    DimensionSummaryLabels to use DimensionLabels internally and removes
    manually implemented protocol conformances.

Checklist

  • The provided tests still run.
  • I've created new tests where needed. (If you have an allocations benchmark suite I can add a test for this change)
  • I've updated the documentation if necessary.

Motivation and Context

Extra allocations cause performance issues in systems with large numbers of metrics and constrained memory.

Description

Updates conformances to avoid allocations.
Tested in instruments.

- Updates DimensionLabels' Equatable and Hashable conformances to avoid
  allocating unnecessary strings. Updates DimensionHistogramLabels and
  DimensionSummaryLabels to use DimensionLabels internally and removes
  manually implemented protocol conformances.
Copy link
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Looks good AFAICS, thanks for the PR @rauhul! 👍

@ktoso ktoso requested a review from MrLotU July 30, 2021 02:25
Copy link
Collaborator

@MrLotU MrLotU left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

@MrLotU MrLotU merged commit d642556 into swift-server:master Jul 30, 2021
@MrLotU
Copy link
Collaborator

MrLotU commented Jul 30, 2021

@ktoso ktoso added this to the 1.0.0-alpha.12 milestone Aug 2, 2021
@rauhul rauhul deleted the bugfix/reduce-allocations branch August 5, 2021 17:13
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.

3 participants