slow perfomance if network directories are in path

조회 수: 10 (최근 30일)
Björn Rumberg
Björn Rumberg 2018년 10월 26일
답변: Mathias 2021년 4월 16일
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
Bruno Luong
Bruno Luong 2018년 10월 26일
편집: Bruno Luong 2018년 10월 26일
" 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 2018년 10월 26일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Mathias
Mathias 2021년 4월 16일
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

카테고리

Help CenterFile Exchange에서 Search Path에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by