Azzera filtri
Azzera filtri

slow perfomance if network directories are in path

3 visualizzazioni (ultimi 30 giorni)
Björn Rumberg
Björn Rumberg il 26 Ott 2018
Risposto: Mathias il 16 Apr 2021
I add several network directories to the path during startup.
If network is not very very good, Matlab performance is dramatically reduced. Each input in the command window takes several seconds. Even if it is just a simple calculation like 1+1. I got the feeling that Matlab is searching the whole path before executing the input. This takes some time due to bad network performance.
Is there any option to increase performance? Such as caching all m files in the path?
  4 Commenti
Bruno Luong
Bruno Luong il 26 Ott 2018
Modificato: Bruno Luong il 26 Ott 2018
" Can I tell manually when to refresh cache and when not to "
Yes REHASH for the first part, no for the second part of your question AFAIK.
Put your commands in function (and not in script) then it caches at the beginning once.
If you use script then there is no way to stop it beside removing the path. That's how it supposes to work.
Walter Roberson
Walter Roberson il 26 Ott 2018
I suspect that the basic problem is that MATLAB automatically checks directories on the path for changed files when it gets to the command prompt. The standard toolboxes are exempt as those are not expected to change.
Be sure to avoid having a network drive open in the directory window.

Accedi per commentare.

Risposte (1)

Mathias
Mathias il 16 Apr 2021
I don't have network pathes in path but tried to check network pathes for existence (i.e. \\device\folders). If the device is not existent it takes around 45sec to check this. After some readings i found a fast solution to get this information. This can be used to deselect invalid pathes for search.
% check for existence of devices
devexists = true;
dev = regexp(pathname, '(?<=^\\\\)[^\\]+(?=\\)', 'ignorecase', 'once', 'match'); % device name
if any(dev)
[~, txt] = dos(['nslookup "' dev '"']);
if any(strfind(txt, 'Non-existent domain'))
devexists = false;
end
end

Categorie

Scopri di più su Search Path in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by