MATLAB: How to fix Slow dir on network drives.

dirMATLABnetwork drivesslow dirslow dir on network drives

For some reason when i run the dir command on a network drive it is extremely slow compared to running it on a folder with a similar number of files/folders on a local drive. Is there a reason this is so slow or is there a workaround for the problem? I am looking to get the list of files/folders within the directory as well as whether it is a file or a directory.
I am running windows 7 with matlab r2012b

Best Answer

It matters a great deal which network filesystem you are using.
If you are using the original NFS (also known as NFSv1) then this behaviour is a consequence of NFSv1's "stateless" design that (if I recall) does not allow caching of directory entries because of the potential synchronization problems if the directory information changed while it was "out" on the network. I no longer recall whether the big improvement for this was NFSv2 or NFSv3.
If you are using Novell then there is a server setting that can help on this, but I refuse to dig that deep into my memory... that was a good decade ago.
If you are using any of the earlier MS Windows network filesystems then I seem to recall that there was a boot.ini setting to adjust the number of network directory slots, and upping it could make a big difference in performance.
I do not know much about any new MS Windows network filesystems.
Related Question