Skip to content

Comments

chore(endpoint): added empty checks#6157

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
gofogo:propoerties-empty-check
Feb 20, 2026
Merged

chore(endpoint): added empty checks#6157
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
gofogo:propoerties-empty-check

Conversation

@ivankatliarchuk
Copy link
Member

@ivankatliarchuk ivankatliarchuk commented Jan 31, 2026

What does it do ?

I captured, that even for 0 properties, there is an improvement if we use Map vs Slice. Reason

  • The speedup is consistent (1.38-1.40x) across all endpoint counts, confirming it's a per-lookup constant overhead, not algorithmic complexity.

So I've added empty check to avoid lookups for specific cases.

if len(e.ProviderSpecific) == 0 {
		.......
	}

To make sure when ZERO properties, Slice and Map behave same way now

The final implementation:

  • GetProviderSpecificProperty: len check + slice iteration
  • SetProviderSpecificProperty: slice iteration + append
  • DeleteProviderSpecificProperty: len check + slice iteration + remove

Motivation

Benchmark results #6156
Map or Slice #5814

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 31, 2026
@coveralls
Copy link

Pull Request Test Coverage Report for Build 21543296792

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 31 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.008%) to 79.185%

Files with Coverage Reduction New Missed Lines %
openshift_route.go 1 84.21%
endpoint.go 30 86.36%
Totals Coverage Status
Change from base Build 21510752750: 0.008%
Covered Lines: 16073
Relevant Lines: 20298

💛 - Coveralls

@szuecs
Copy link
Contributor

szuecs commented Feb 11, 2026

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: szuecs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 11, 2026
Copy link
Contributor

@vflaux vflaux left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 20, 2026
@k8s-ci-robot k8s-ci-robot merged commit fedb434 into kubernetes-sigs:master Feb 20, 2026
19 checks passed
@ivankatliarchuk ivankatliarchuk deleted the propoerties-empty-check branch February 21, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants