-
Notifications
You must be signed in to change notification settings - Fork 507
COLLECTIONS-873: create PatriciaTrieSet #589
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
base: master
Are you sure you want to change the base?
COLLECTIONS-873: create PatriciaTrieSet #589
Conversation
|
Hello @ekuvardin |
|
@garydgregory Now:
Benchmarks results |
|
Summary How it works All new classes are put on a picture below. TrieSet PatriciaTrieSet RangePatriciaTrieSortedSet To do so, I create an inner class RangePatriciaTrieSortedSet in PatriciaTrieSet RangePatriciaTrieSortedSet doesn't immediately construct SortedSet; it's a wrapper under PatriciaSet.RangeEntryMap and PatriciaSet.PrefixRangeMap works in the same manner. Objects in this SortedMap are sorted according to lexicographical order. Benchmarks Benchmarks results |
|
Merge with master and fix new checkstyle warnings that come with the latest master commits. |

According to https://issues.apache.org/jira/browse/COLLECTIONS-873
MR is basically a draft or discussion of what to do.
I make PatriciaTrieSet based on PatriciaTrie under the hood.
Below I type what I don't like. Please give some advice.
The main problem is when I access PatriciaTrie, I have to return SortedSet.
But all collections under the hood of PatriciaTrie don't use SortedSet.
Thus, I wrap call under TreeSet.
For example
This is overwhelming because the keySet is already sorted, and adding to a TreeSet also takes time.
To improve the situation, I make two approaches:
The drawback is that a change (bug) in bit operations leads to a rewrite in PatriciaTrieSet and PatriciaTrie independently.
public interface NavigableMap<K,V> extends SortedMap<K,V>From NavigableMap, I can get navigableKeySet and work with it in PatriciaTrieSet.