MATLAB 2020b slow to return errors

6 vues (au cours des 30 derniers jours)
Matt McMatlab
Matt McMatlab le 6 Mar 2023
Commenté : Matt McMatlab le 8 Mar 2023
Background
My workplace supports a variety of different Matlab versions with the most current version being 2020b. I've been using 2016a though beacause 2020b is so slow to return errors that makes it unusable.
I put the following code in a test script called speedTest.m that's purposely written to cause an error.
char()+cell(1)
I then ran the script in both versions of Matlab using the profiler to illustrate the problem.
2016a
Running the profiler in 2016a, the script runs quickly and returns the expected error:
2020b
Running the profiler in 2020b, the script is very slow to run and return the expected error:
Things I've Tried
I read this thread that suggests the problem is due to Matlab searching network drive paths for variables and functions which can be slow. My startup script does add a bunch of network drive paths for functions and libraries that our group uses but I run the exact same startup script in any version of Matlab I use. The slow error return has never been a problem in the 4 years that I've been using 2016a. I've been able to get by using 2016a but now I need to work with third party Matlab code that requires a newer version (because the string() function didn't exist in 2016a).
Question
It looks like error checking changed between versions but why is it so much slower in 2020b?
  14 commentaires
Chris
Chris le 7 Mar 2023
Modifié(e) : Chris le 7 Mar 2023
My thought process was, the network drive is at the top of the search path. If the connection is dropped (or refused?), the delay will occur when Matlab looks there first. Indeed, the first time I try anything in Matlab (any function, doesn't have to cause an error. "1+1" does it) after disconnecting from the VPN, the delay occurs. Something happens after that first attempt that prevents the delay for that function, but now try "1-1" and there's the delay again.
On the other hand, if Matt's problem is really only triggered by calls to error(), then perhaps it's unrelated.
For the record, I think these servers use smb (though I'm not sure how Windows would know that before connecting)
@dpb interestingly, your speed test doesn't catch the 20s delay.
Matt McMatlab
Matt McMatlab le 8 Mar 2023
@dpb I ran the same test as you with the faulty char()+cell(1) command within a try-catch statement and it ran in 0.002916 sec for me. So it seems like the issue only happens when Matlab is actively returning the error which I think is why we've all seen it at some point when doing something as simple as mistyping a variable in the command window.
@Chris I have mapped network drives that I can only access through our VPN. Older projects in our group are stored on the network drives so there's no way around needing to work off of them but I don't have issues accessing them in Matlab. It's definitely slower than working off a local drive but I think that's just my VPN throttling me and not the fault of Matlab. I have experienced the delay you described when the VPN connection drops though. I've always assumed it was because Matlab was trying to reconnect to the license server since it happens to me in both 2016a and 2020b. I usually type in something like "1+1" and once it finally runs, then I'm good to go until the next time the VPN drops out.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Manage Products dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by