help understanding profiler results

1 view (last 30 days)
huss
huss on 13 Apr 2014
Commented: dpb on 13 Apr 2014
Hi, I have this toy example code, that takes about 20 seconds to run on my machine:
A = randn(400, 257);
B = randn(257, 200);
C = randn(30, 50);
D = randn(50, 100);
for k = 1:30000
A*B;
C*D;
end
toc;
When I comment the A*B line inside the for loop, it takes approximately half a second to run. When the C*D line is commented, it takes about 20 seconds. However, when I run the profiler (on the original code), I get:
The running times do not correspond to what is obtained when each line is commented... Any explanation?
I run MATLAB 2012b on MacOSX-64.
Thanks
  1 Comment
dpb
dpb on 13 Apr 2014
profiler takes overhead--it's not indicative of non-profiled code excepting in relative performance. It's intended use is simply to identify bottlenecks, not for absolute timings.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!