Skip to content
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

reduce number of allocations in ScanForLinks #24

Merged
merged 2 commits into from
Jul 3, 2020

Conversation

whyrusleeping
Copy link
Owner

No description provided.

@whyrusleeping whyrusleeping requested review from Kubuxu and magik6k July 3, 2020 00:07
@whyrusleeping
Copy link
Owner Author

improvement:

why@cassiopeia ~/c/cbor-gen (master)> go test ./testing -bench=BenchmarkLink
goos: linux
goarch: amd64
pkg: github.com/whyrusleeping/cbor-gen/testing
BenchmarkLinkScan-56    	  291818	      4642 ns/op	     772 B/op	      40 allocs/op

why@cassiopeia ~/c/cbor-gen (feat/reduce-scan-for-links-allocs)> go test ./testing -bench=BenchmarkLink
goos: linux
goarch: amd64
pkg: github.com/whyrusleeping/cbor-gen/testing
BenchmarkLinkScan-56    	  334290	      4159 ns/op	     707 B/op	      19 allocs/op
PASS
ok  	github.com/whyrusleeping/cbor-gen/testing	2.049s

@whyrusleeping whyrusleeping merged commit 1be7fe2 into master Jul 3, 2020
@whyrusleeping whyrusleeping deleted the feat/reduce-scan-for-links-allocs branch July 3, 2020 00:38
}); err != nil {
return nil, err
}
const maxCidLength = 100

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this apply to embedded identity multihash links?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ianopolous yes, though only if youre using this method. Is that an issue? I guess we can make it a var instead of a const so you can tweak it in your own applications

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only interact over the http api. So hopefully that doesn't affect us then? I can't think of a use case where it actually matters unless pinning could end up calling this to get links and then error?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this library is used in go-ipfs indirectly through go-ipld-cbor: https://github.com/ipfs/go-ipld-cbor/blob/master/go.mod#L12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants