Can you measure the performance of a function that calls multiple functions within using 'timeit'?
5 ビュー (過去 30 日間)
古いコメントを表示
I want to use timeit (or tic-toc) to measure the performance of a function. I am calling this function within a loop to measure the timing information multiple times and then averaging. When I run this function once, suppose the timing is measured to be m1±s1 (mean±standard deviation) across N runs (in the loop that I mentioned). The standard deviation is not very high, quite acceptable. However, if I execute this loop again, say in an hour, it becomes m2±s2, the mean changes to m2 which is quite different from m1. s2 however remains small. Can I know how to use timeit properly? What factors does it depend on?
P.S. I am NOT doing the following within the functions (as mentioned in the timeit documentation)
- Using timeit between tic and toc
- Using timeit to time a function that includes calls to tic and toc
- Using timeit recursively
4 件のコメント
Rik
2019 年 10 月 16 日
I don't think that should matter, as long as you run the function with the same input.
If your function contacts some server, there will be a dependency on your internet connection, but I don't see any such external factors in your description.
Also, your question is not urgent, the reason for that is explained here. I therefore removed that part from your question title.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!