Skip to content

Commit 2fdb356

Browse files
authored
Merge pull request #5080 from chlunde/perf-2
perf: Intersection: Avoid callid AllIds inside inner loop
2 parents 5dff9df + 4842d8b commit 2fdb356

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/internal/accumulator/resaccumulator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ func (ra *ResAccumulator) FixBackReferences() (err error) {
170170

171171
// Intersection drops the resources which "other" does not have.
172172
func (ra *ResAccumulator) Intersection(other resmap.ResMap) error {
173+
otherIds := other.AllIds()
173174
for _, curId := range ra.resMap.AllIds() {
174175
toDelete := true
175-
for _, otherId := range other.AllIds() {
176+
for _, otherId := range otherIds {
176177
if otherId == curId {
177178
toDelete = false
178179
break

0 commit comments

Comments
 (0)