Preallocate nodes slice in addNodes before populating it
This commit is contained in:
		| @@ -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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user