Merge pull request #5080 from chlunde/perf-2

perf: Intersection: Avoid callid AllIds inside inner loop
This commit is contained in:
Kubernetes Prow Robot
2023-03-20 23:03:07 -07:00
committed by GitHub

View File

@@ -170,9 +170,10 @@ func (ra *ResAccumulator) FixBackReferences() (err error) {
// Intersection drops the resources which "other" does not have.
func (ra *ResAccumulator) Intersection(other resmap.ResMap) error {
otherIds := other.AllIds()
for _, curId := range ra.resMap.AllIds() {
toDelete := true
for _, otherId := range other.AllIds() {
for _, otherId := range otherIds {
if otherId == curId {
toDelete = false
break