Can you measure the performance of a function that calls multiple functions within using 'timeit'?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Rik
le 16 Oct 2019
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.
Réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!