My code is running incredibly slow. I have it setup so that it plots every so often throughout the "For" loop, but the plotting is unusually slow. I cannot spot the problem in my code. At the end you will notice that I have it pausing for a brief period of time so that the plot can be viewed.
Thank You, JS

4 commentaires

per isakson
per isakson le 25 Avr 2016
Modifié(e) : per isakson le 25 Avr 2016
Because, the code requires more RAM than you have in your computer. That's my guess.
James
James le 26 Avr 2016
I believe that if this was the case that the code would cease running when it ran out of memory, thus I do not believe that this is the issue.
Clayton Ragsdale
Clayton Ragsdale le 29 Mai 2019
Once your RAM runs out of memory, it then starts using your hard drive, the data transfer between RAM, and hard drive is very slow; thus it could be possible that your computer requires more RAM. If not the case, check your techniques on saving memory and run time
Walter Roberson
Walter Roberson le 29 Mai 2019
Whether swapping to SSD or hard disc occurs depends upon the operating system and system configuration. It is, however, typical that some swap to disc can happen, and that is rather slow.

Connectez-vous pour commenter.

 Réponse acceptée

jgg
jgg le 26 Avr 2016
Modifié(e) : jgg le 26 Avr 2016

0 votes

Try using the profiler, as per isakson recommends. This will give you an idea of what is taking up your time. MATLAB will use a paging system if it runs out of RAM on most systems, which is very slow but prevents crashing; I see that you use like 85% of my system memory here, which is about 8 GB so it would depend on your system.
I tried this with the code you sent, and it indicated that line 118 was the problem. It doesn't seem to need to be there, since your code should generate one anyways, so I just commented it out and the performance improved dramatically; for reference, after that change, this runs in about 31s on my system.
The plotting still seems to be the slowest part of your code. Perhaps it would be better to just save the data to be plotted, then perform the plotting at the end. I'm clear why it's quite so slow, but you do have a lot of points to plot.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by