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

labels: small optimization in NewFrom and various cleanups #30006

Merged
merged 3 commits into from
Jan 8, 2024

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Dec 20, 2023

  • Avoid re-allocation in NewFrom
  • Use labels.LabelSourceK8s const instead of open-coding it
  • Remove unused AppendPrefixInKey

See commits for details.

It's unused since commit 7eb7f22 ("EndpointSelector: replacing
LabelArray with k8s LabelSelector").

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser added kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact. labels Dec 20, 2023
@tklauser tklauser requested review from a team as code owners December 20, 2023 13:46
@tklauser
Copy link
Member Author

/test

Copy link
Member

@giorio94 giorio94 left a comment

Choose a reason for hiding this comment

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

/lgtm

Nit. s/instad/instead/ in the title of the second commit.

Use the predefined const.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
Allocate a label map of the correct known size.

name       old time/op    new time/op    delta
NewFrom-8     638ns ± 8%      71ns ± 6%   -88.87%  (p=0.000 n=10+10)

name       old alloc/op   new alloc/op   delta
NewFrom-8      624B ± 0%        0B       -100.00%  (p=0.000 n=10+10)

name       old allocs/op  new allocs/op  delta
NewFrom-8      2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser
Copy link
Member Author

/test

Copy link
Contributor

@squeed squeed left a comment

Choose a reason for hiding this comment

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

sweet sweet.

@tklauser tklauser added this pull request to the merge queue Jan 8, 2024
Merged via the queue into main with commit 1281f1c Jan 8, 2024
207 checks passed
@tklauser tklauser deleted the pr/tklauser/labels-cleanup branch January 8, 2024 10:44
@tklauser tklauser added the needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch label Jan 10, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in v1.15.0-rc.1 Jan 10, 2024
@jibi jibi mentioned this pull request Jan 12, 2024
32 tasks
@jibi jibi added backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. and removed needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch labels Jan 12, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.15 in v1.15.0-rc.1 Jan 12, 2024
@giorio94 giorio94 added the backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. label Jan 29, 2024
@giorio94 giorio94 removed the backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. label Jan 29, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.15 to Backport done to v1.15 in v1.15.0-rc.1 Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
v1.15.0-rc.1
Backport done to v1.15
Development

Successfully merging this pull request may close these issues.

None yet

4 participants