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

Version 3 proposal: Store optional member data in a single hash #26

Closed

Conversation

czarneckid
Copy link
Member

This has the benefit of not using a separate hash for every single
member's data. As is updated in the documentation, you can store
more data for a given member by, for example, encoding a Hash
in JSON. Not only will this save on Hash-splosion if using member
data in a leaderboard, it also means that when deleting a
leaderboard, we can also delete ALL of the member data at once. In
version 2.x, if using member data, you would have to go through and
delete the member data hashes individually. Yikes!

David Czarnecki added 3 commits September 16, 2012 18:35
This has the benefit of not using a separate hash for every single
member's data. As is updated in the documentation, you can store
more data for a given member by, for example, encoding a Hash
in JSON. Not only will this save on Hash-splosion if using member
data in a leaderboard, it also means that when deleting a
leaderboard, we can also delete ALL of the member data at once. In
version 2.x, if using member data, you would have to go through and
delete the member data hashes individually. Yikes!
This has the benefit of not using a separate hash for every single
member's data. As is updated in the documentation, you can store
more data for a given member by, for example, encoding a Hash
in JSON. Not only will this save on Hash-splosion if using member
data in a leaderboard, it also means that when deleting a
leaderboard, we can also delete ALL of the member data at once. In
version 2.x, if using member data, you would have to go through and
delete the member data hashes individually. Yikes!
…of github.com:agoragames/leaderboard into version-3-proposal-store-member-data-in-a-single-hash
@hypomodern
Copy link
Contributor

Have we benchmarked the two approaches?

@czarneckid
Copy link
Member Author

Benchmarked which approaches?

@hypomodern
Copy link
Contributor

You are proposing to change the present implementation. Is your proposed change slower or faster or "doesn't matter" than the original? It seems to me this is one area where performance might matter, since you'll often be retrieving or updating a bunch of member data in one unit of work.

@czarneckid
Copy link
Member Author

It will be faster since we are only ever retrieving one piece of data O(1) in this implementation from a Redis hash as opposed to retrieving all of the items from a hash O(n) in the previous implementation. Also, retrieving member data when pulling leader data is still optional in the call.

@czarneckid
Copy link
Member Author

This code has been integrated into the version 3 branch.

@czarneckid czarneckid closed this Nov 9, 2012
This was referenced May 24, 2013
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