Skip to content

Commit

Permalink
fix: skip traversal of pointers with the same cid (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
birdychang authored May 11, 2023
1 parent bfa9ebb commit a0b13f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func diffNode(ctx context.Context, pre, cur *Node, depth int) ([]*Change, error)

// both pointers are shards, recurse down the tree.
if prePointer.isShard() && curPointer.isShard() {
if prePointer.Link == curPointer.Link {
continue
}
preChild, err := prePointer.loadChild(ctx, pre.store, pre.bitWidth, pre.hash)
if err != nil {
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions diff_parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ func (s *diffScheduler) work(ctx context.Context, todo *task, results chan *Chan
switch {
// both pointers are shards, recurse down the tree.
case prePointer.isShard() && curPointer.isShard():
if prePointer.Link == curPointer.Link {
return nil
}
preChild, err := prePointer.loadChild(ctx, pre.store, pre.bitWidth, pre.hash)
if err != nil {
return err
Expand Down

0 comments on commit a0b13f3

Please sign in to comment.