make comments of updateIndices optimization code more accurate

Kubernetes-commit: 0eae1f3addbd044793dac89f9e097e5f4c6fb2aa
This commit is contained in:
Jian Li 2022-03-14 13:56:17 +08:00 committed by Kubernetes Publisher
parent dedf7ce61c
commit 6b59aa0b4a

View File

@ -281,14 +281,14 @@ func (c *threadSafeMap) updateIndices(oldObj interface{}, newObj interface{}, ke
}
for _, value := range oldIndexValues {
// We optimize for the most common case where index returns a single value.
// We optimize for the most common case where indexFunc returns a single value.
if len(indexValues) == 1 && value == indexValues[0] {
continue
}
c.deleteKeyFromIndex(key, value, index)
}
for _, value := range indexValues {
// We optimize for the most common case where index returns a single value.
// We optimize for the most common case where indexFunc returns a single value.
if len(oldIndexValues) == 1 && value == oldIndexValues[0] {
continue
}