-
Notifications
You must be signed in to change notification settings - Fork 161
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
perf: Use the libipld built in way to scrape references #388
perf: Use the libipld built in way to scrape references #388
Conversation
@@ -1400,18 +1400,16 @@ impl<T: ContentLoader> Resolver<T> { | |||
/// Extract links from the given content. | |||
pub fn parse_links(cid: &Cid, bytes: &[u8]) -> Result<Vec<Cid>> { | |||
let codec = Codec::try_from(cid.codec()).context("unknown codec")?; | |||
let mut cids = BTreeSet::new(); |
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 might argue that a hashset would be faster here, and you would not be wrong. I guess it is my determinism fetish...
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.
nice 💙
Note that with this I am not entirely convinced that sending the cids over the RPC is worth it. The store can scrape the links. Unless we foresee a scenario where you would want to send different links than the block contains, but that would be weird... |
e2ce2d2
to
f84da6e
Compare
...without having to create an AST. Should be much faster.
f84da6e
to
d57b12a
Compare
Oh well, another error. Made an issue for this since it is unrelated to this: n0-computer/beetle#124 |
...without having to create an AST. Should be much faster.
This has been working all the time for dag-cbor since we needed that at actyx, but I have also made the dag-pb case a bit faster in ipld/libipld#155