Optimise NewDerivedNode()

Create the new node's children without making an intermediate NodeSet
This commit is contained in:
Bryan Boreham
2018-07-20 20:29:52 +00:00
parent 69e61cb362
commit 67052a6580

View File

@@ -52,7 +52,9 @@ func ParseGroupNodeTopology(topology string) (string, string, bool) {
// NewDerivedNode makes a node based on node, but with a new ID
func NewDerivedNode(id string, node report.Node) report.Node {
return report.MakeNode(id).WithChildren(node.Children.Add(node))
result := report.MakeNode(id)
result.Children = node.Children.Add(node)
return result
}
// NewDerivedPseudoNode makes a new pseudo node with the node as a child