Commit 7b3638ea authored by Jonathan Basseri's avatar Jonathan Basseri

Avoid string concatenation when comparing pods.

Pod comparison in (*NodeInfo).Filter was using GetPodFullName before comparing pod names. This is a concatenation of pod name and pod namespace, and it is significantly faster to compare name & namespace instead.
parent 8bd5a460
......@@ -510,12 +510,11 @@ func getPodKey(pod *v1.Pod) (string, error) {
// matches NodeInfo.node and the pod is not found in the pods list. Otherwise,
// returns true.
func (n *NodeInfo) Filter(pod *v1.Pod) bool {
pFullName := util.GetPodFullName(pod)
if pod.Spec.NodeName != n.node.Name {
return true
}
for _, p := range n.pods {
if util.GetPodFullName(p) == pFullName {
if p.Name == pod.Name && p.Namespace == pod.Namespace {
return true
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment