Slow debugging for long scripts

조회 수: 13(최근 30일)
Jakob Sievers
Jakob Sievers 2013년 11월 26일
댓글: Jakob Sievers 2013년 11월 28일
Hi all
I know that ideally I should try to break up long scripts into smaller components, and I plan on doing that, but for now I have once more reached around 3000 lines in one script and usually that is no problem but for some reason the debugging on this one is incredibly slow. Writing is delayed at times by seconds which is a bit of a nuisance. The problem persists even if the program has not been run which made me think that software could be the problem. I tried updating from 2012b to 2013a thinking that the problem would be resolved but it hasn't been so far.
Any suggestions? (apart from breaking up the script into smaller pieces of course).


Vishal Rane
Vishal Rane 2013년 11월 26일
Try code folding. Keep only the code that you are working on unfolded. That would improve the code readability, might also require less java memory. Also divide your code into code sections and debug one section at a time rather than the entire file.

Simon 2013년 11월 26일
You can try to disable the code analyzing feature under "File -> Preferences -> Code Analyzer". Writing should not be delayed then.
Splitting your script in logical parts (using functions for repetetive tasks) is also a good idea, but you know that already ;-)

Jakob Sievers
Jakob Sievers 2013년 11월 28일
편집: Jakob Sievers 2013년 11월 28일
Hi again
Neither of the proposed solutions seem to resolve the situation. It has to be a software situation because even after a clean reboot and no other programs running, scripts upwards of 6000 lines (I know, I know) that never used to give me any problems all of a sudden are extremely slow in terms of just basic writing. I initially thought maybe the particular script i was working on was taxing on my memory and hence led to slow debugging times but if the problem persists without actually having run any of the code and while having code analyzer disabled (I assume what was meant was to uncheck the "Enable Integrated Warnings and error messages" button) then I am not sure what would cause the problem. The end result is of course that I will spend time breaking up my code and separate programs in the future but the situation is a bit puzzling.
Thanks for the advice anyway.
  댓글 수: 2
Jakob Sievers
Jakob Sievers 2013년 11월 28일
I'm going to try to break it up a bit. It's just really puzzling. As I said I have never had this issue, otherwise I would've never made it anywhere near ~6000 lines without changing my approach. It's like matlab developed a sensitivity towards long scripts over-night and I can't really blame it on a new version of Matlab because I upgraded specifically because I thought my outdated version was to blame in the first place. All stats (RAM, HDD, Processors) show no real activity but when I add a couple of lines to a script, even without having run anything, Matlab jumps to ~12% of all CPU power (I have 8 cores so this in itself is really impressive). The only thing I can think of that I have changed recently is that I have begun backing up my harddives using crashplan so the network is always busy but I can't see how that relates to writing code in Matlab and the crashplan program is only taking up a couple of percent processing power anyway.
Really puzzling.

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

Community Treasure Hunt

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

Start Hunting!

Translated by