-
Notifications
You must be signed in to change notification settings - Fork 38
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
Use IPLD-prime: target merge branch #67
Conversation
Probably known, but noting out loud: this needs a rebase onto master (or some manual merging, owner's choice). However, it doesn't look like it should be too nasty.
|
I think I'm mostly okay with this? Per reasoning in the big review of repos and goalposts for this mergeparty I made over in AFAICT, checklist to get this ready for mergeparty:
|
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.
Not many blocking issues, but this code is fairly tricky so I've asked for clarification in a number of places. Also, we need to rebase on master since we're out of date
Fix functionality for decode function -- was using incorrect decoder and not handling maybe cases
Points worth noting: 1) go-ipld-prime-proto contains a raw codec, but go-codec-dagpb does not. We're adding one such codec to go-ipld-prime, so for now, just add one here to keep the tests passing. 2) dagpb uses a slightly different schema. In particular, the Data field is optional, but a link's Hash is not. 3) As per the dag-pb spec, and following the above, links must contain hashes. This required updating a number of tests. Note that TestStableCID gets its CID changed because of this. go-ipld-prime-proto arrives at the same new CID with the new node. dagutils.TestInsertNode still fails, because it arrives at a different CID hash, but it's not clear why just yet.
to make merkeldag work with linksystem, update ipld-prime, go-codec-dagpb, and ipld-legacy
Allocate all the underlying links at once. This means one alloc per call, instead of one alloc per link. name old time/op new time/op delta Roundtrip-8 5.34µs ± 1% 5.20µs ± 1% -2.61% (p=0.002 n=6+6) name old alloc/op new alloc/op delta Roundtrip-8 7.50kB ± 0% 7.44kB ± 0% -0.85% (p=0.002 n=6+6) name old allocs/op new allocs/op delta Roundtrip-8 148 ± 0% 139 ± 0% -6.08% (p=0.002 n=6+6)
It's unclear to me why we did the Bytes+Cast dance for each cid.Cid in the links list. Perhaps to do a copy, but that wouldn't make sense as dagpb only reads the CIDs when marshaling. We can use the same Cid value directly, which shaves off a significant amount of allocation overhead. name old time/op new time/op delta Roundtrip-8 5.20µs ± 1% 4.81µs ± 0% -7.53% (p=0.004 n=6+5) name old alloc/op new alloc/op delta Roundtrip-8 7.44kB ± 0% 7.14kB ± 0% -4.09% (p=0.002 n=6+6) name old allocs/op new allocs/op delta Roundtrip-8 139 ± 0% 119 ± 0% -14.39% (p=0.002 n=6+6)
Cutting out the bytes.Buffer middleman saves a non-trivial amount of work, it turns out. name old time/op new time/op delta Roundtrip-8 3.24µs ± 3% 4.07µs ± 0% +25.72% (p=0.002 n=6+6) name old alloc/op new alloc/op delta Roundtrip-8 4.94kB ± 0% 6.38kB ± 0% +29.13% (p=0.002 n=6+6) name old allocs/op new allocs/op delta Roundtrip-8 109 ± 0% 103 ± 0% -5.50% (p=0.002 n=6+6)
f034e22
to
d863a07
Compare
@aschmahmann I believe I've addressed most comments and this is ready for re-review |
func (n *ProtoNode) UnmarshalJSON(b []byte) error { | ||
s := struct { | ||
Data []byte `json:"data"` | ||
Links []*ipld.Link `json:"links"` | ||
Data []byte `json:"data"` | ||
Links []*format.Link `json:"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.
@warpfork @rvagg @willscott does this need to be changed to Data
and Links
? Perhaps relatedly will this code be used anywhere anymore?
Use IPLD-prime: target merge branch This commit was moved from ipfs/go-merkledag@8794146
superseeds #64