Why Would an m-file run quickly but publishing it runs slowly?
7 views (last 30 days)
Show older comments
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 Comment
Answers (1)
Ken Atwell
on 19 Sep 2012
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 Comments
Ken Atwell
on 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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!