Preallocate nodes slice in addNodes before populating it
This commit is contained in:
parent
609934ce99
commit
c108188d65
@ -1,12 +1,11 @@
|
|||||||
package registry
|
package registry
|
||||||
|
|
||||||
func addNodes(old, neu []*Node) []*Node {
|
func addNodes(old, neu []*Node) []*Node {
|
||||||
var nodes []*Node
|
nodes := make([]*Node, len(neu))
|
||||||
|
|
||||||
// add all new nodes
|
// add all new nodes
|
||||||
for _, n := range neu {
|
for i, n := range neu {
|
||||||
node := *n
|
node := *n
|
||||||
nodes = append(nodes, &node)
|
nodes[i] = &node
|
||||||
}
|
}
|
||||||
|
|
||||||
// look at old nodes
|
// look at old nodes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user