'matlabpath' taking too long on startup

13 次查看(过去 30 天)
Currently, if I run the path command when starting matlab, the result is on the order of 1800 directories. This results in 'matlabpath' taking 120 seconds to complete when starting matlab (verified using the -timing option). The 120 second figure is on a fast machine (a slow machine can take 5 minutes).
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.00 0.00 0.00 main
5.10 5.10 0.00 Session Initialize
6.45 0.14 1.21 LM Startup
6.45 0.00 0.00 splash
13.01 0.13 6.43 Constant Initialization
13.06 6.61 0.00 Engine Startup
13.67 0.61 0.00 InitSunVM
18.56 4.73 0.16 PostVMInit
18.56 5.49 0.00 mljInit
18.56 5.50 0.00 Java initialization
18.66 0.06 0.04 psParser
185.78 166.88 0.25 matlabpath
185.80 0.00 0.02 MATLAB Addons registration
186.49 0.03 0.66 matlabrc
=========================================================
Items shown account for 97.5% of total startup time [TIMER: 1 MHz]
The typical solution to this is "install fewer packages" or "install it locally", but neither of these options are available (because the packages are all needed/used, and there isn't enough hard disk space to house it locally).
What is matlab doing in this 'matlabpath' command on startup? Can this be sped up? Most of these files are stored on SSDs on the network which is faster than the local spinning rust anyway, so is this a latency issue?
Network Statistics:
--- server.loc ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss
rtt min/avg/max/mdev = 0.081/0.141/0.326/0.015 ms
------------------
--- iperf3 to server ---
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 1.10 GBytes 942 Mbits/sec 0 sender
[ 5] 0.00-10.04 sec 1.10 GBytes 938 Mbits/sec receiver
R2021a Update 5 (9.10.0) 64-bit (glnxa64)

回答(1 个)

Aakash Garg
Aakash Garg 2021-12-14
编辑:Walter Roberson 2024-3-6
Hello Earl,
Its seems a problem with adding the path to MATLAB.
Run the following command in the command window-
>> cd(prefdir + "../../../")
% Run the platform specific function
% Windows
>> !start .
%Mac
>> !open .
%Linux
>>!xdg-open .
% This should open File Explorer
Close all sessions of MATLAB. Now, rename the MATLAB folder to MATLAB_old.
Open MATLAB. This should resolve the issue.
P.S.- Refer to this if you are curious why this happened - https://www.mathworks.com/matlabcentral/answers/99625
In short, you were trying to add too many folders to MATLABPATH.
Regards,
Aakash Garg
MathWorks
  1 个评论
Yuhan
Yuhan 2024-3-6
Hi Aakash,
This is Yuhan. I have recently encountered this problem as well. However, the solution you proposed didn't help. The matlabpath stills takes too long. I ran in cmd matlab -timing and get the partial log, which is attached:
total item gap description
16.88 10.99 5.90 Init Desktop
175.39 147.32 21.16 matlabpath
Can you please further look into this?
Best,
Yuhan

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by