![]() Instead of listing all ReplicaSets in the namespace and checking their controller UID, this patch adds a controllerUID index to the ReplicaSet store and use it to get ReplicaSets with same controller, which reduces the cost from O(#ReplicaSets) to O(1). Benchmark results: ``` name old time/op new time/op delta GetReplicaSetsWithSameController-48 18.2µs ± 9% 0.4µs ± 5% -97.64% (p=0.008 n=5+5) name old alloc/op new alloc/op delta GetReplicaSetsWithSameController-48 4.18kB ± 0% 0.05kB ± 0% -98.85% (p=0.008 n=5+5) name old allocs/op new allocs/op delta GetReplicaSetsWithSameController-48 15.0 ± 0% 2.0 ± 0% -86.67% (p=0.008 n=5+5) ``` |
||
---|---|---|
.. | ||
config | ||
doc.go | ||
init_test.go | ||
OWNERS | ||
replica_set_test.go | ||
replica_set_utils_test.go | ||
replica_set_utils.go | ||
replica_set.go |