Why is there a time difference in tic toc in multiple runs
1 回表示 (過去 30 日間)
古いコメントを表示
In the following code, the execution time returned by tic toc varies in each run. Why?
tic ones(50) toc
0 件のコメント
回答 (1 件)
Rick Rosson
2016 年 2 月 2 日
Because tic toc measures elapsed time rather than cpu time. Try using profile instead.
3 件のコメント
Steven Lord
2016 年 2 月 2 日
What if during one iteration your computer "phones home" looking for updates but during another it doesn't?
What if instead it's your virus scanner that is checking for updates?
What if during one iteration tic "starts timing" exactly at the start of one clock tick and ends at the end of that same tick, but during another it starts in the middle of one tick and ends in the middle of another?
The times returned should be very similar but they're not going to be identical unless everything about your system is exactly the same. If you had a VM, saved its state, and restored back to that state that would probably be about as close as you could get to that scenario.
Walter Roberson
2016 年 2 月 2 日
What if your computer has to get busy popping up Clippy to remind you that you have not saved a document?
参考
カテゴリ
Help Center および File Exchange で Performance and Memory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!