Skip to content

Commit c9ccfc6

Browse files
committed
Fix comparison of children in graph generation
Replace the URI comparison with pointer comparison, this removes all allocations during the children comparison. The register already guarantees that multiple URIs are not registered. Change the ordering of the comparison first check the most likely filter and do the set check last. Signed-off-by: Derek McGowan <derek@mcg.dev>
1 parent 6f6f966 commit c9ccfc6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (registry Registry) Graph(filter DisableFilter) []Registration {
135135
func children(reg *Registration, registry []*Registration, added, disabled map[*Registration]bool, ordered *[]Registration) {
136136
for _, t := range reg.Requires {
137137
for _, r := range registry {
138-
if !disabled[r] && r.URI() != reg.URI() && (t == "*" || r.Type == t) {
138+
if (t == "*" || r.Type == t) && r != reg && !disabled[r] {
139139
children(r, registry, added, disabled, ordered)
140140
if !added[r] {
141141
*ordered = append(*ordered, *r)

0 commit comments

Comments
 (0)