wilfred-s commented on code in PR #949:
URL: https://github.com/apache/yunikorn-k8shim/pull/949#discussion_r1945747250
##########
pkg/cache/context.go:
##########
@@ -1621,9 +1621,9 @@ func (ctx *Context) finalizeNodes(existingNodes
[]*v1.Node) error {
}
// convert the node list into a map
- nodeMap := make(map[string]*v1.Node)
+ nodeMap := make(map[string]struct{}, len(nodes))
Review Comment:
From a readability perspective I would prefer `nodeMap :=
make(map[string]bool, len(nodes))` and set `true` in 1626
Then at line 1631 the check simply becomes `if !nodeMap[node.Name] {`
Size (~5% more) and speed wise (not measurable unless the map has millions
of entries) it does not make a difference when you consider what we use it for.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]