javax.imageio.ImageIO ThreadLocal use
Alan Bateman
Alan.Bateman at oracle.com
Tue May 9 19:07:26 UTC 2023
On 09/05/2023 19:47, Duncan Gittins wrote:
> Alan
>
> thanks for the information. I'll wipe my allowSetThreadLocal calls and
> add -Djdk.traceVirtualThreadLocals=true to monitor this from JDK21+.
>
> 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.
>
ImageIO.setUseCaches configures caching on the file system. From a quick
look it doesn't appear to be caching in TLs. In any case, you've found
the system property to help track down usages of TLs that might not
scale with a lot of virtual threads.
-Alan
More information about the loom-dev
mailing list