Sunday, February 12, 2006

Matlab code time execution

Most people is familiar with tic; toc; commands in matlab to check execution of their code;

But more detail insight into this problem is by profile viewer.


This nice tool shows exactly how much time is used by each line, how many times it is executed. Moreover, profiler also gives some suggestions how to improve execution time.

For example, thanks to profiler I was able to reduce time of one image processing program from few hours to few minutes. Profiler showed me, that very simple operation, takes huge amount of time. Just by removing, changing and rewriting few time consuming lines, I was able to significantly shorten exec time of my program.