Skip to content

Commit

Permalink
some performance holes in the integration test still
Browse files Browse the repository at this point in the history
  • Loading branch information
wcharczuk committed Feb 12, 2024
1 parent 7aa10c7 commit 20516e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
11 changes: 2 additions & 9 deletions bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ func (b *bindIncr[A, B]) Stabilize(ctx context.Context) error {
}

func (b *bindIncr[A, B]) Link(ctx context.Context) (err error) {
if err = b.linkBindChange(ctx); err != nil {
return
if b.bindChange != nil {
Link(b.bindChange, b.input)
}
if b.bound != nil {
Link(b.bound, b.bindChange)
Expand All @@ -178,13 +178,6 @@ func (b *bindIncr[A, B]) Link(ctx context.Context) (err error) {
}
}
}
for _, n := range b.scope.rhsNodes {
if typed, ok := n.(IBind); ok {
if err = typed.Link(ctx); err != nil {
return
}
}
}
}
return
}
Expand Down
6 changes: 3 additions & 3 deletions bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,19 +1028,19 @@ func Test_Bind_nested_amplification(t *testing.T) {
}
err := g.Stabilize(ctx)
testutil.Nil(t, err)
testutil.Equal(t, 81, g.numNodes)
testutil.Equal(t, 65, g.numNodes)

for _, o := range observed {
testutil.NotNil(t, o.Value())
}

err = g.Stabilize(ctx)
testutil.Nil(t, err)
testutil.Equal(t, 81, g.numNodes)
testutil.Equal(t, 65, g.numNodes)

err = g.Stabilize(ctx)
testutil.Nil(t, err)
testutil.Equal(t, 81, g.numNodes)
testutil.Equal(t, 65, g.numNodes)
}

func Test_Bind_boundChange_doesntCauseRebind(t *testing.T) {
Expand Down
4 changes: 3 additions & 1 deletion unlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ func Unlink(child, input INode) {
child.Node().removeParent(input.Node().id)
input.Node().removeChild(child.Node().id)

graphFromAnyScope(child, input).checkIfUnnecessary(input)
if graph := graphFromAnyScope(child, input); graph != nil {
graph.checkIfUnnecessary(input)
}
}

func graphFromAnyScope(nodes ...INode) *Graph {
Expand Down

0 comments on commit 20516e0

Please sign in to comment.