<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi loom devs - Happy New Year!<div class=""><br class=""></div><div class="">I have been digging into loom and testing the performance.</div><div class=""><br class=""></div><div class="">I think I see an area for possible improvement in the scheduler. See the following async profiler capture:</div><div class=""><br class=""></div><div class=""><img apple-inline="yes" id="18869FF1-F602-45F2-A1CA-C344AD377C77" class="" width="640" height="419" src="cid:3062B371-CC12-47A9-B3F1-2EC968627A6D"></div><div class=""><br class=""></div><div class="">Notice that the most expensive operation in the system is that the ForkJoin worker is parking attempting to schedule work due to contention on the DelayedWorkQueue lock (the vthread is trying to park itself for N nanos). Ordinarily I wouldn’t be too concerned with micro benchmarks, but the primary goal of Loom is efficiency and this seems like it should be fairly straightforward to address with a specialized lock-free structure for use by Loom carrier threads. I have to expect the Loom design is to handle vthreads will a very short runtime until park/reschedule.</div><div class=""><br class=""></div><div class="">As it is, I wrote a specialized lock, rather than using the standard ReentrentLock since the standard always ended up parking the acquiring too soon - only to be awoken nearly immediately, and then rescheduled. It seems better to use some heuristics based on the cost of schedule switch and the expected park time and then spin for N loops prior to parking.</div><div class=""><br class=""></div><div class="">I see the same behavior with both JDK19 and JDK20.</div><div class=""><br class=""></div><div class="">Does the above look reasonable? Any other suggestions?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></body></html>