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

Reuse postings and avoid fmt.Sprintf to reduce mem allocations #3767

Merged
merged 6 commits into from
Aug 8, 2019

Conversation

manishrjain
Copy link
Contributor

@manishrjain manishrjain commented Aug 7, 2019

This change is Reviewable

@manishrjain manishrjain requested a review from martinmr as a code owner August 7, 2019 01:44
Copy link

@pullrequest pullrequest bot left a 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.

Copy link

@pullrequest pullrequest bot left a 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

@manishrjain manishrjain requested a review from a team as a code owner August 7, 2019 01:50
Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

:lgtm: 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).

Copy link

@pullrequest pullrequest bot left a 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() {
Copy link

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.

Copy link
Contributor

@martinmr martinmr left a 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.

Copy link
Contributor Author

@manishrjain manishrjain left a 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.

@manishrjain manishrjain merged commit 6fd4dc4 into master Aug 8, 2019
@manishrjain manishrjain deleted the mrjn/reuse-postings branch August 8, 2019 18:26
danielmai pushed a commit that referenced this pull request Aug 9, 2019
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants