Is Julia slow at closing files on Windows?

Hello!

It is hard to provide a MWE, since this is a pattern I observe when running a simulation in Julia. I time the different operation and I see that closing a file through HDF5.jl takes up more time than I think it should:

image

To save time while running my simulation I store output file identifiers in a vector and then close them all at the end of the simulation, which is why only one call is present. Still, it takes ~7 seconds to close 201 files, which is quite a long time compared to the other operations. Because file closing is slow, I cannot close a file instantly when I am done with it, would stall simulation time.

Does anyone know if this is;

  1. Specific to Windows?
  2. Specific to HDF5.jl?
  3. Specific to HDF it self?

And does anyone know how to close files faster?

Kind regards

Closing files on Windows is slow. If you try the same code under WSL2, it might be faster.

2 Likes