Skip to content

feat: optimize cid.Prefix#109

Merged
whyrusleeping merged 1 commit intomasterfrom
feat/optimize-prefix
Jul 23, 2020
Merged

feat: optimize cid.Prefix#109
whyrusleeping merged 1 commit intomasterfrom
feat/optimize-prefix

Conversation

@Stebalien
Copy link
Member

We call this frequently and having to allocate here is really unfortunate.

We call this frequently and having to allocate here is really unfortunate.
@Stebalien Stebalien requested a review from whyrusleeping July 23, 2020 02:48
offset += n
mhlen, _, _ := uvarint(c.str[offset:])

return Prefix{

Choose a reason for hiding this comment

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

could allocate this struct before the uvarint's above, and then read version / type / codec directly into the member fields

Copy link
Member

Choose a reason for hiding this comment

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

eh, it won't save us anything. Its all in registers at the end of the day

@Kubuxu
Copy link
Member

Kubuxu commented Jul 23, 2020

@Stebalien are we sure that varint in the c.str is well structured? Otherwise uvarint witll return negative n.

@Kubuxu
Copy link
Member

Kubuxu commented Jul 23, 2020

Ahh, doc is bad. uvarint doesn't return negative n anymore.

@whyrusleeping whyrusleeping merged commit 8b9ff39 into master Jul 23, 2020
@aschmahmann aschmahmann mentioned this pull request Sep 22, 2020
72 tasks
@mvdan mvdan deleted the feat/optimize-prefix branch July 1, 2021 16:12
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.

4 participants