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

make mapHash return something other than 0 #2263

Merged
merged 1 commit into from Dec 25, 2013

Conversation

mebigfatguy
Copy link
Contributor

as written

int intKey = (key >> 32 ^ key);

creates 0, as shifting by 32 is the same as shifting by 0, then exclusive oring with self is 0. always 0.

Make the hash distributed, by adding parens

int intKey = (key >> (32 ^ key));

kitskub added a commit that referenced this pull request Dec 25, 2013
make mapHash return something other than 0
@kitskub kitskub merged commit 52f0992 into spoutdev:master Dec 25, 2013
@kitskub
Copy link
Contributor

kitskub commented Dec 25, 2013

@mebigfatguy What kind of implications does this have?

@mebigfatguy
Copy link
Contributor Author

The way it was before, all you map entries where hashed to the same bucket, turning your map into a collection that had List-like performance for lookup, etc. You probably could do even better with that hash function, but certainly it was not good at all as it was, and should be much better.

@kitskub
Copy link
Contributor

kitskub commented Dec 25, 2013

So you're saying this provides a speed increase?

@mebigfatguy
Copy link
Contributor Author

should, how measurable, hard to say.

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