Borrar filtros
Borrar filtros

slow perfomance if network directories are in path

6 visualizaciones (últimos 30 días)
Björn Rumberg
Björn Rumberg el 26 de Oct. de 2018
Respondida: Mathias el 16 de Abr. de 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 comentarios
Bruno Luong
Bruno Luong el 26 de Oct. de 2018
Editada: Bruno Luong el 26 de Oct. de 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 el 26 de Oct. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Mathias
Mathias el 16 de Abr. de 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

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by