Instability of computation time for a matlab code

3 ビュー (過去 30 日間)
Felix Wong
Felix Wong 2018 年 7 月 17 日
コメント済み: Felix Wong 2018 年 7 月 19 日
Hi, I am testing a matlab code to evaluate computation time of my program. I used tic/toc as a measure for the elaspsed time, and operated for a total of 500 times. Below shows results of the testing, i.e., computation time (in sec) versus time of running. As can be seen in the plot, computation time before 230 times of running is quite stable, around 15 sec/run. However, in the later part of the testing, the computation time is quite unstable. Accounting all 500 times of running will give an average computation time of 24 sec/run, instead of 15 sec/run for 230 times of running.
I have some questions: 1). Which value should I used to evalute the computation speed of my code? 15 or 24 sec/run; 2). What is the reason for such variations in the later part of my program? Does this mean my program is unstable? or does all matlab programs behave the same way?
Thanks a lot! :)

回答 (1 件)

Image Analyst
Image Analyst 2018 年 7 月 17 日
Maybe a virus scan or backup was happening during the slow times, or a corporate download of new or additional software. These things happen all the time with me and affect all programs, not just MATLAB.
  3 件のコメント
Image Analyst
Image Analyst 2018 年 7 月 17 日
Are you using Windows? Type control-shift-Esc to bring up the task list and see how much CPU, disk, or internet is being used and by what programs. In Windows 10 look at the performance tab to see time plots of them all. Windows Superfetch process is often a guilty party - just Google it.
Felix Wong
Felix Wong 2018 年 7 月 19 日
Thank you for your information. I am using Windows 7. After several testing, I think the problem may be due to loading of a very large parameter data in the program in each running. I have incoporate the load command into the program. I guess I should put it outside the function, and load it in prior to the running of the program.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by