10000 Fix #5293 - changed the way hashcode is improved in hash sets. by axel22 · Pull Request #61 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

Fix #5293 - changed the way hashcode is improved in hash sets. #61

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

Closed
wants to merge 1 commit into from

Conversation

axel22
Copy link
Contributor
@axel22 axel22 commented Dec 19, 2011

The hash code is further improved by using a special value in the hash sets
called a seed. For sequential hash tables, this value depends on the size
of the hash table. It determines the number of bits the hashcode should be
rotated. This ensures that hash tables with different sizes use different
bits to compute the position of the element. This way traversing the elements
of the source hash table will yield them in the order where they had similar
hashcodes (and hence, positions) in the source table, but different ones in
the destination table.

Ideally, in the future we want to be able to have a family of hash functions
and assign a different hash function from that family to each hash table
instance. That would statistically almost completely eliminate the possibility
that the hash table element traversal causes excessive collisions.

I should probably @mention extempore here.

The hash code is further improved by using a special value in the hash sets
called a `seed`. For sequential hash tables, this value depends on the size
of the hash table. It determines the number of bits the hashcode should be
rotated. This ensures that hash tables with different sizes use different
bits to compute the position of the element. This way traversing the elements
of the source hash table will yield them in the order where they had similar
hashcodes (and hence, positions) in the source table, but different ones in
the destination table.

Ideally, in the future we want to be able to have a family of hash functions
and assign a different hash function from that family to each hash table
instance. That would statistically almost completely eliminate the possibility
that the hash table element traversal causes excessive collisions.

I should probably @mention extempore here.
@axel22 axel22 closed this Dec 19, 2011
szeiger pushed a commit to szeiger/scala that referenced this pull request Mar 20, 2018
eed3si9n added a commit to eed3si9n/scala that referenced this pull request May 14, 2019
FPORT: Avoid CCE when scalac internally uses compileLate
lrytz pushed a commit to lrytz/scala that referenced this pull request Nov 5, 2019
FPORT: Avoid CCE when scalac internally uses compileLate
Rewritten from sbt/zinc@768a3a8
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.

1 participant
0