# Is Julia slow at closing files on Windows?

**URL:** <https://discourse.julialang.org/t/is-julia-slow-at-closing-files-on-windows/112983>\
**Category:** Performance\
**Created:** [April 15, 2024, 11:52pm UTC](https://discourse.julialang.org/t/is-julia-slow-at-closing-files-on-windows/112983 "2024-04-15T23:52:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [April 15, 2024, 11:52pm UTC](https://discourse.julialang.org/t/is-julia-slow-at-closing-files-on-windows/112983/1 "2024-04-15T23:52:59Z")

</div>

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](https://global.discourse-cdn.com/julialang/original/3X/c/f/cfbecbb68443f6a1193589e5e7d5f38e243fa6e9.png)

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

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 16, 2024, 12:38am UTC](https://discourse.julialang.org/t/is-julia-slow-at-closing-files-on-windows/112983/2 "2024-04-16T00:38:21Z")

</div>

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