RFR: 8360046: Scalability issue when submitting virtual threads with almost empty tasks [v17]
Doug Lea
dl at openjdk.org
Mon Nov 24 17:39:08 UTC 2025
On Thu, 20 Nov 2025 15:21:36 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Tweaks
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1261:
>
>> 1259: if ((a = array) != null && (cap = a.length) > 0) { // else disabled
>> 1260: int k = (m = cap - 1) & s;
>> 1261: if ((room = m - (s - b)) >= 0) {
>
> Not that I think it'd make much of a difference, but it would be possible to do the following:
>
> Suggestion:
>
> int k;
> if ((room = (k = (m = cap - 1) & s) - (s - b)) >= 0) {
Yes, but no: javac doesn't understand that the use of k in signalWork isn't reached, so it seems better to just assign it anyway (an optimizer might figure out when to avoid it .)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2557168322
More information about the core-libs-dev
mailing list