RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v17]

Doug Lea dl at openjdk.org
Mon Jun 3 11:19:08 UTC 2024


On Sun, 2 Jun 2024 14:33:45 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reconcile changes
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1345:
> 
>> 1343:             int b = base, p = top, cap;
>> 1344:             if (p - b > 0 && a != null && (cap = a.length) > 0) {
>> 1345:                 for (int m = cap - 1, s, nb;;) {
> 
> @DougLea I'm curious, what effect did you see if moving the `p - b > 0` out of the loop conditional?

This was part of saving a read in the common case of empty local queue. Barely but reliably worth doing.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1624246576


More information about the core-libs-dev mailing list