RFR: 8322732: ForkJoinPool may underutilize cores in async mode
Viktor Klang
vklang at openjdk.org
Fri May 10 12:45:32 UTC 2024
On Fri, 10 May 2024 12:09:20 GMT, Doug Lea <dl at openjdk.org> wrote:
>> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2167:
>>
>>> 2165: }
>>> 2166: }
>>> 2167: return stat;
>>
>> @DougLea Since `stat` is a local, and is only written to once per branch it might make sense to just return from each of the branches?
>
> A similar answer as above: using a single return avoids compiler generating branches to its own synthetic single return. Worthwhile only when whole method is of this form (I did check this one.)
I prefer having methods with a single return, placed on the last line of the method, but I wanted to make sure I wasn't missing any underlying reason. :)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1596706172
More information about the core-libs-dev
mailing list