performance (rendering): Make Node merge a mutating operation.

We only ever call it in contexts where we don't need the original node
to be untouched.
This commit is contained in:
Bryan Boreham
2020-06-04 15:28:18 +00:00
parent 38782ca75a
commit 74182867af
4 changed files with 26 additions and 28 deletions

View File

@@ -180,9 +180,11 @@ func (ret *joinResults) mapChild(from, to string) {
// Note it is not safe to mix calls to add() with addChild(), addChildAndChildren() or addUnmappedChild()
func (ret *joinResults) add(from string, m report.Node) {
if existing, ok := ret.nodes[m.ID]; ok {
m = m.Merge(existing)
existing.UnsafeMerge(m)
ret.nodes[m.ID] = existing
} else {
ret.nodes[m.ID] = m
}
ret.nodes[m.ID] = m
ret.mapChild(from, m.ID)
}