-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimise pin update command #4348
Conversation
This handles merkle links that aren't named. And improves the Peergos usage from worst case 30s to ~20ms License: MIT Signed-off-by: Ian Preston <ianopolous@protonmail.com>
a8135b2
to
885de4f
Compare
var aonly []*cid.Cid | ||
for _, l := range b.Links() { | ||
inb[l.Cid.KeyString()] = l | ||
} | ||
for _, l := range a.Links() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be faster to just call KeyString()
once, bind it to a local variable here. (also easier on memory)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
merkledag/utils/diffenum.go
Outdated
} | ||
|
||
var out []diffpair | ||
var aindex = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just say var aindex int
License: MIT Signed-off-by: Ian Preston <ianopolous@protonmail.com>
8e4d5e9
to
825add0
Compare
I think we should make sure that the name pairing still works properly with this change, so that links with the same name (or 'path' within the object) still create the same resulting 'change' object |
I believe that the name matching property will be maintained with this pr, as long as the Links() function is only a function of the ipld topology of the object. I will write a test to verify this. |
d4d442a
to
ab9e491
Compare
License: MIT Signed-off-by: Ian Preston <ianopolous@protonmail.com>
ab9e491
to
4f11baa
Compare
@@ -65,27 +65,35 @@ type diffpair struct { | |||
// getLinkDiff returns a changeset between nodes 'a' and 'b'. Currently does | |||
// not log deletions as our usecase doesnt call for this. | |||
func getLinkDiff(a, b node.Node) []diffpair { | |||
have := make(map[string]*node.Link) | |||
names := make(map[string]*node.Link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right. The Name
property of links is a protonode thing (that needs to die).
Hooray! My first commits to go-ipfs! :-) |
This handles merkle links that aren't named. And improves the
Peergos usage from worst case 30s to ~20ms