Matlab is unpredictably slow

조회 수: 15 (최근 30일)
Dan
Dan 2016년 6월 10일
편집: Stephen23 2016년 6월 11일
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
Stephen23
Stephen23 2016년 6월 10일
편집: Stephen23 2016년 6월 11일
"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 2016년 6월 10일
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.

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

답변 (1개)

Dan
Dan 2016년 6월 10일
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
John D'Errico
John D'Errico 2016년 6월 10일
Please don't add an answer when you wish to make a comment.

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

카테고리

Help CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by