-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Reuse postings and avoid fmt.Sprintf to reduce mem allocations #3767
Conversation
…re fingerprints directly.
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.
✅ A review job has been created and sent to the PullRequest network.
Check the status or cancel PullRequest code review here.
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.
1 Message | |
---|---|
📂 | Since this pull request is no longer open, the code review job will remain active in the PullRequest network until you cancel it - or - 48 hours pass with no activity after feedback has been posted. Read More |
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.
Just make sure that the fingerprint change doesn't break anything.
Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @manishrjain)
posting/list.go, line 429 at r1 (raw file):
// here to save memory allocations. // Not entirely sure about effect on collision chances due to this simple XOR with uid. return farm.Fingerprint64(key) ^ uid
Can you also explain what the XOR is for?
Not sure what testing for this would be like but make sure you run the full suite (not sure if it runs already by default).
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.
Changes here make sense to me switching to an xor-ed fingerprint for a faster hash.
Reviewed with ❤️ by PullRequest
posting/list.go
Outdated
}, | ||
} | ||
|
||
func (l *List) Release() { |
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.
May consider adding a docstring for this exported method to match others in the file and help with go doc generation.
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @manishrjain and @pullrequest[bot])
posting/list.go, line 404 at r1 (raw file):
Previously, pullrequest[bot] wrote…
May consider adding a docstring for this exported method to match others in the file and help with go doc generation.
Actually, I don't think this method needs to be exported for now.
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.
Addressed the comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @martinmr and @pullrequest[bot])
posting/list.go, line 404 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
Actually, I don't think this method needs to be exported for now.
Made it private.
posting/list.go, line 429 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
Can you also explain what the XOR is for?
Not sure what testing for this would be like but make sure you run the full suite (not sure if it runs already by default).
We have to make UID part of the conflict key. Now that we're operating on a hash, the best I could think of was to XOR it with the UID, both being uint64.
* Let's reuse postings * Do not use fmt.Sprintf to generate collision key. Instead use and store fingerprints directly. * Make release private (cherry picked from commit 6fd4dc4)
This change is