Reuse cached pointers when ordering resolution changes

This commit is contained in:
2026-11-02 17:40:12 +00:00
parent e878ce51ff
commit 795cc2f379
3 changed files with 31 additions and 18 deletions

View File

@@ -1,11 +1,6 @@
package engine
import (
"cmp"
"slices"
"go.maximumdirect.net/configkit/internal/document"
)
import "go.maximumdirect.net/configkit/internal/document"
// compareResolutionValues reports field-level changes at stable list positions.
func compareResolutionValues(before, after *document.Node, correspondence ...resolutionCorrespondence) []documentDelta {
@@ -61,11 +56,5 @@ func compareResolutionValues(before, after *document.Node, correspondence ...res
}
}
compare(before, after, Path{})
slices.SortFunc(deltas, func(a, b documentDelta) int {
if order := cmp.Compare(a.path.String(), b.path.String()); order != 0 {
return order
}
return int(a.kind) - int(b.kind)
})
return deltas
return sortDocumentDeltas(deltas)
}