Why Would an m-file run quickly but publishing it runs slowly?
Afficher commentaires plus anciens
I have created a relatively short m-file that runs completely in ~10 seconds and produces the output I expect (couple of plots). However, publishing it to either a pdf or html causes it to slowdown. Very slow. It takes about 20 minutes to publish.
Are there particular functions I should look out for? I'm confused since it obviously solves very quickly.
This will probably require some discourse since I'm not going to post my code here (yet). This is a homework assignment and I don't want to post this online until it's due (later this week), so there is the ability to discuss it then.
1 commentaire
Walter Roberson
le 19 Sep 2012
Possibly you are publishing at much higher resolution ?
Réponses (1)
Ken Atwell
le 19 Sep 2012
0 votes
We'd need the code to be sure, but I'll guess that publishing is causing the JIT to not kick in some situation when normally it would kick in when running freely.
Bracketing each block of code with tic/toc will narrow down the culprit, and then maybe you can share just that one subsection here on Answers.
2 commentaires
Ken Atwell
le 19 Sep 2012
Turn all three "%%"'s into just "%". I believe publishing will pause to gather state whenever it encounters a "%%", so don't do this within your loop.
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!