On Fri, 12 Jan 2024 08:51:16 GMT, Volker Simonis wrote:
>>> tryPresize(int size) is doing and if its size argument is supposed to
>>> contain the additional number of elements which will be inserted into the
>>> hash map or if it is a hint for the new total size of the hash map
>>
>> Argument
On Thu, 11 Jan 2024 19:21:00 GMT, Joshua Cao wrote:
>>> We don't need to compute max() here.
>>> [tryPresize()](https://github.com/openjdk/jdk/blob/8a4dc79e1a40e7115e2971af81623b6b0368f41c/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java#L2397)
>>> does that already.
>>
On Thu, 11 Jan 2024 09:40:07 GMT, Volker Simonis wrote:
> tryPresize(int size) is doing and if its size argument is supposed to contain
> the additional number of elements which will be inserted into the hash map or
> if it is a hint for the new total size of the hash map
Argument `size` for
On Mon, 8 Jan 2024 20:27:59 GMT, Joshua Cao wrote:
> We don't need to compute max() here.
> [tryPresize()](https://github.com/openjdk/jdk/blob/8a4dc79e1a40e7115e2971af81623b6b0368f41c/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java#L2397)
> does that already.
The code
On Mon, 8 Jan 2024 15:59:17 GMT, Volker Simonis wrote:
> Shouldn't this be something like tryPresize(this.size() + m.size()) to
> accommodate for the worst case where there are no common keys in this map and
> m?
Its a good callout. Not sure if it is a miss, or intentionally conservative.
>
On Wed, 3 Jan 2024 21:29:57 GMT, Joshua Cao wrote:
>> ConcurrentHashMap's copy constructor calls `putAll()` -> `tryPresize()` ->
>> `transfer()`. When coming from the copy constructor, the Map is empty, so
>> there is nothing to transfer. But `transfer()` will still copy all the empty
>>
On Wed, 3 Jan 2024 21:29:57 GMT, Joshua Cao wrote:
>> ConcurrentHashMap's copy constructor calls `putAll()` -> `tryPresize()` ->
>> `transfer()`. When coming from the copy constructor, the Map is empty, so
>> there is nothing to transfer. But `transfer()` will still copy all the empty
>>
On Wed, 3 Jan 2024 19:52:34 GMT, Joshua Cao wrote:
>> test/micro/org/openjdk/bench/java/util/concurrent/Maps.java line 122:
>>
>>> 120: public void testCopyConstructor() {
>>> 121: ConcurrentHashMap clone = new
>>> ConcurrentHashMap<>(staticMap);
>>> 122: dummy = clone;
>>
> ConcurrentHashMap's copy constructor calls `putAll()` -> `tryPresize()` ->
> `transfer()`. When coming from the copy constructor, the Map is empty, so
> there is nothing to transfer. But `transfer()` will still copy all the empty
> nodes from the old table to the new table.
>
> This patch