RFR: 8319447: Improve performance of delayed task handling [v4]
Doug Lea
dl at openjdk.org
Tue Feb 25 21:06:55 UTC 2025
On Tue, 25 Feb 2025 14:51:29 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Standardize parameter checking
>
> src/java.base/share/classes/java/util/concurrent/DelayScheduler.java line 455:
>
>> 453: final long nextDelay; // 0: once; <0: fixedDelay; >0: fixedRate
>> 454: int heapIndex; // if non-negative, index on heap
>> 455: final boolean isImmediate; // run by scheduler vs submitted when ready
>
> If desired, it would be possible to create a bitset for `isImmediate` and `isCallable` such that we could get rid of a reference field per ScheduledForkJoinTask.
> I suspect it would also be possible to use the same field for `pool` and `result` as there shouldn't be a result available for as long as `pool` is non-null.
>
> Might not be worth doing at this point, but saving 2 reference fields for something which might get allocated millions of times might be worth it?
I tried a few variants and didn't see improvements. But I added a sentence to doc with my guess why:
* (We use the same structure for both
* Runnable and Callable versions, since including an extra field
* in either case doesn't hurt -- it seems mildly preferable
* for these objects to be larger than other kinds of tasks to
* reduce false sharing during possibly frequent bookkeeping
* updates.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23702#discussion_r1970539084
More information about the core-libs-dev
mailing list