DouglasNeuroInformatics / software_quarantine

1 stars 0 forks source link

MATLAB startup time #18

Open yasharz opened 10 months ago

yasharz commented 10 months ago

It takes a long time for MATLAB to start

here are the details from matlab -timing:

    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                                    
 0.08   0.08    0.00   Session Initialize                      
54.45   0.00   54.37     Toolbox cache load Start              
54.45   0.36   54.01   Session Initialize                      
54.72   0.28   54.45   cachepath                               
54.73   0.07   54.66   LM Startup                              
54.74   0.01    0.00   splash                                  
56.36   0.07    1.55     Constant Initialization               
56.41   1.66    0.00   Engine Startup                          
56.52   0.11    0.00      InitSunVM                            
57.06   0.52    0.02      PostVMInit                           
57.06   0.66    0.00     mljInit                               
57.29   0.23    0.00     StartDesktop                          
57.29   0.89    0.00   Java initialization                     
57.29   0.00    0.00   psParser                                
57.29   0.00    0.00   Toolbox cache join                      
57.95   0.46    0.19   matlabpath                              
110.52   0.03   52.54   matlabrc                                
111.81   0.00    1.30     SettingsConstructorLoadingFiles       
111.81   0.01    1.29   SettingsConstructorLoadingFiles         
114.12  56.83   57.29     Init Desktop                          
114.27  56.97   57.29   Ready                                   
=========================================================
Items shown account for 53.2% of total startup time

Please let me know if you need more information from my side.

thomasbeaudry commented 10 months ago

The toolbox cache is taking forever to load. @gdevenyi maybe we set toolboxCacheEnabled to false?

gdevenyi commented 10 months ago

The toolbox cache is taking forever to load. @gdevenyi maybe we set toolboxCacheEnabled to false?

This is the opposite of what we want. That would result in matlab traversing the entire toolbox directory every time.

Things of note

  1. The cache should be used on startup, but it looks like MATLAB is being dumb and updating it when it really shouldn't (latest update Jan 12 14:45 however the matlab install hasn't changed and so this file shouldn't update. (ref https://www.mathworks.com/help/matlab/matlab_env/toolbox-path-caching-in-the-matlab-program.html)
  2. MATLAB doesn't use a sensible working directory approach, instead storing tons of things in $HOME, and we know $HOME has performance issues.

@yasharz Two options

  1. We relocate ~/.matlab to the local drive. MATLAB settings will be per-system
  2. We relocate ~/.matlab to your /data allocation, will be slightly slower but be consistent across systems.

Either way, we should redirect MATLAB logging to tmp

export MATLAB_LOG_DIR="$XDG_CACHE_HOME/matlab"