Matlab is unpredictably slow

16 次查看(过去 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

类别

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