Skip to content

Remove HashProvider and deprecate it#1

Merged
thekid merged 2 commits intomasterfrom
refactor/remove-hashprovider
Apr 23, 2017
Merged

Remove HashProvider and deprecate it#1
thekid merged 2 commits intomasterfrom
refactor/remove-hashprovider

Conversation

@thekid
Copy link
Copy Markdown
Member

@thekid thekid commented Apr 23, 2017

This pull request changes the way hashcodes are computed for HashTable, HashSet, Queue and Stack. Instead of keeping track of the hashcode when writing, it is computed when hashCode() is invoked, which occurs much less often!

This yields a speedup factor between 2 and 4 - see this measuring code:

# Before
$ xp -m ..\measure\ util.profiling.Measure Collections -n 100000
hashTable: 100000 iteration(s), 0.674 seconds, result= "value"
hashSet: 100000 iteration(s), 0.458 seconds, result= 1
queue: 100000 iteration(s), 0.576 seconds, result= "green"
stack: 100000 iteration(s), 0.404 seconds, result= "green"

# After
$ xp -m ..\measure\ util.profiling.Measure Collections -n 100000
hashTable: 100000 iteration(s), 0.332 seconds, result= "value"
hashSet: 100000 iteration(s), 0.249 seconds, result= 1
queue: 100000 iteration(s), 0.135 seconds, result= "green"
stack: 100000 iteration(s), 0.097 seconds, result= "green"

This pull request does not introduce a BC break. However, future major versions will remove the now-deprecated class HashProvider. Although it's a purely internal class is was not clearly marked as such and might have gotten used.

@thekid thekid merged commit bc07ac3 into master Apr 23, 2017
@thekid thekid deleted the refactor/remove-hashprovider branch April 23, 2017 16:15
thekid added a commit that referenced this pull request Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant