Details
-
Improvement
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
None
-
None
-
None
Description
When creating ConcurrentHashMap:
BinaryUtils.java
new ConcurrentHashMap<>(U.capacity((map).size()));
[1], [2] `U.capacity` returns capacity that is sufficient to keep the map from being resized. In ConcurrentHashMap this is unnecessary because recalculation already performs in the constructor.
Similar problem in GridConcurrentHashSet because inside it implements ConcurrentHashMap:
DataStreamerImpl.java
keys = new GridConcurrentHashSet<>(entries.size(), U.capacity(entries.size()), 1);
[3],[4] result of `U.capacity` is passed as `loadFactor` value. When loadFactor == U.capacity, initial size of table is 1.
This leads to performance penalty due to rehashing of internal map.
Attachments
Issue Links
- links to