-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Optimize immutable.HashSet builder (inspired by the 2.13 implementation) #8722
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
Conversation
e8b79b2 to
e4bdf43
Compare
f0e004c to
2f5cac3
Compare
private def compressedIndex(trie: HashTrieSet[A], rawIndex: Int): Int = {
if (trie.bitmap == -1) rawIndex
else {
assert ((trie.bitmap & (1 << rawIndex)) != 0)
Integer.bitCount(((1 << rawIndex) - 1) & trie.bitmap)
}
} |
dd34036 to
4bd8b49
Compare
|
removed the offending assert |
7df64a6 to
9df4cdd
Compare
For example: |
0d182e4 to
c6d8f2d
Compare
|
I'm hesitant to include this in 2.12.11 because of the closeness of the release and the size of this change. I'd be comfortable merging it straight after the release and then reaching out to folks to start testing nightlies. That could also include the other big backport PRs you have in progress like the |
@retronym thats fine. For the work that inspired this we can take a private build from the 2.12. head and test it internally as part of that review process. |
|
squashed |
1dabd45 to
f2c5ce0
Compare
f2c5ce0 to
5c6c6b2
Compare
The builder allows TrieHashSet to be mutated in place until it is visible this reduces the memory churn while building Sets don't allow build to emit an empty collection unless it the canonical one i.e. (newBuilder() ++= new HashHet()).result() should be EmptyHashSet
5c6c6b2 to
42bc67b
Compare
…etBuilder HashSet builder
…etBuilder HashSet builder
The builder allows
TrieHashSetto be mutated in place until it is visible this reduces the memory churn while buildingSets.Benchmark results: https://gist.github.com/mkeskells/7a4b80bb358f18afe541e0ce737aa691