So no reason not to try to split the load over a couple of threads then, in particular as there’s decoding to do as well. It seems to me like there’s some thread unsafety in FileIO because reading directly with PNGFiles works fine for me.
using PNGFiles
filenames = filter(x->endswith(x, ".png"), readdir("."; join=true));
x = Vector{Any}(undef, length(filenames));
@sync for (i, path) in enumerate(filenames)
Threads.@spawn begin
x[i] = PNGFiles.load(path)
end
end
This is probably not a good way to get performance but at least there should be no fundamental problem with multithreading it.
Update: When I try this with 100 png files of size 4096x4096 and 8 threads I get a factor 4 speedup over sequential read. Seems fairly decent.