Matlab is unpredictably slow

21 Ansichten (letzte 30 Tage)
Dan
Dan am 10 Jun. 2016
Bearbeitet: Stephen23 am 11 Jun. 2016
Like many other users, I have experienced my code (on occasion) running TEN times slower than it normally does. I have read a fair number of posts about JIT and PCode but cannot determine if this is my problem since I can't reliably reproduce the slow execution! It's a bit maddening. After experiencing the slow performance, I rerun the code & it runs MUCH faster. In order to try & reproduce the slow performance, I tried "clear all" and even restarted Matlab... to no avail! The code runs fine for a while until.... at some point in the future... it becomes slow as molasses again.
Any ideas of how I can reliably reproduce the slow performance so I can attack it? I can't post my code but I should say that it is both memory and disk intensive.
Thanks!
Dan
  2 Kommentare
Stephen23
Stephen23 am 10 Jun. 2016
Bearbeitet: Stephen23 am 11 Jun. 2016
"Like many other users"
Really, which "many other" users? Can you provide a reference for this?
I know of many cases where MATLAB is predictably slow due to poor code practices or a busy CPU/memory, but I have never heard of "many other users" suffering from unpredictably slow code.
John D'Errico
John D'Errico am 10 Jun. 2016
Don't go off and use a web browser when you are running MATLAB. Don't have other stuff running in the background. Even if your machine is has multiple cores, this cuts MATLAB's access to the CPUs that it needs.
Don't try to solve too big problems. If you solve marginally large problems, then SOMETIMES you will force MATLAB to use swap space heavily. That causes the code to wait will your disk thrashes. Disk access is far slower than RAM access.
There are other reasons why it MIGHT be slow, many of them a direct function of what you are doing, your problem etc. Since we don't know what you are doing, we cannot guess why you have issues. The crystal ball is so foggy. I bought some crystal ball anti-fogging fluid from an online retailer though, so that may help.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Dan
Dan am 10 Jun. 2016
First of all, I apologize for using the expression "many other users". After further experimentation, it seems like John has put his finger on the problem as I think that I can now reliably cause my code to slow to a crawl by simply not interacting with Matlab for "a while". So it might be the OS (OSX) trying to be "smart" and swap stuff in & out of virtual memory. I will try and simplify my code so I can post it for others to try along with all my system specs and some information from OSX's "activity monitor".
Thanks!
Dan
  1 Kommentar
John D'Errico
John D'Errico am 10 Jun. 2016
Please don't add an answer when you wish to make a comment.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Install Products finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by