<div dir="ltr">Alan<div><br></div><div>thanks for the information. I'll wipe my allowSetThreadLocal calls and add -Djdk.traceVirtualThreadLocals=true to monitor this from JDK21+.</div><div><br></div><div>Unfortunately I'm not an expert on ImageIO - my observations (not backed with solid JMH stats) are that JPG loading is quite slow, disabling caching "ImageIO.setUseCache(false);" strangely appears to make it faster, and for the NAS/USB storage devices I have it seems that preloading a whole file into memory before calling Image.read(InputStream) beats Image.read(File) directly. Not an issue for loom-dev, and I may be incorrect anyway.</div><div><br></div><div>Kind regards</div><div><br></div><div>Duncan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 9 May 2023 at 19:01, Alan Bateman <<a href="mailto:Alan.Bateman@oracle.com">Alan.Bateman@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 09/05/2023 18:46, Duncan Gittins wrote:<br>
> :<br>
><br>
> I happened to be stripping out all my ThreadLocal code recently, and <br>
> so decided to check this work by adding "allowSetThreadLocals(false)" <br>
> onto all virtual thread builders to disable ThreadLocal use.<br>
<br>
We decided not to make allowSetThreadLocals a permanent API so it has <br>
been removed for Java 21. JEP 444 [1] provides a bit on the reasons for <br>
this.<br>
<br>
We haven't discussed the TL usage in the image I/O area here. Most of <br>
the effort on reducing usages of TL has been in the base/core area. If <br>
you have proposals/ideas for reducing the usage in the image I/O code <br>
then it would be good to bring them to client-libs-dev? If the TLs are <br>
for caching purposes then it's good to create some benchmarks to see if <br>
the caching helps or makes things worse.<br>
<br>
-Alan<br>
<br>
[1] <a href="https://openjdk.org/jeps/444" rel="noreferrer" target="_blank">https://openjdk.org/jeps/444</a><br>
</blockquote></div>