Merge pull request #115922 from sourcelliu/impovevolume

Improve performance of method haveOverlap
This commit is contained in:
Kubernetes Prow Robot 2023-02-21 11:34:08 -08:00 committed by GitHub
commit 4dfd2fe74d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,11 +144,7 @@ func haveOverlap(a1, a2 []string) bool {
if len(a1) > len(a2) {
a1, a2 = a2, a1
}
m := make(sets.String)
for _, val := range a1 {
m.Insert(val)
}
m := sets.New(a1...)
for _, val := range a2 {
if _, ok := m[val]; ok {
return true