31 CommentsOldest to Newest
I like these simple videos; they actually show me how a pro uses the same tools that I use everyday, it develops my skills
I have used profiler before but I really think that using profiler efficiently needs some skills or at least you have to have some sense of code optization, otherwise you will be trapped in a bottle-neck like correct code
A good suggestion for these video series would be how to use a source control system in MATLAB, I am anxious to watch something on it
Great idea for a first video to share!
How about sharing a little info about how you made the video?
I used Camtasia for the recording.
I am using the profiler a lot, it’s very helpful. But sometimes it returns strange results. Occasionally it tells me that most time (such as >60%) is spent at an “END” statement. I have not yet been able to find information anywhere that explains why the code would spend so much time at a statement that does essentially nothing. Any ideas on that?
SNIP doug not only having lost a shock of hair…
firstly, the loop uses a var BITS, which is NOT pre-allocated (as properly shown in the alternative[?] section) – hence, the demo may broadcast a very false message… customers beware…
secondly, the movie can be done (so much!) better…
just a pedestrian note with a :-)
That is awesome! I never knew this existed! Its cooler then those Progress Bars!
BITS indeed is not pre-allocated in the first block of code. That is part of the problem with the original code. These errors in the code are intentional, that is the point of the demonstration. Even with pre-allocation, the new code is a great improvement. In a longer demo, this pre-allocation error is found with the m-lint feature of the profiler.
Glad to see people are looking closely.
I did not know the answer, so I went to development and got this answer:
“What the customer is seeing is not a bug but a side effect of how the JIT [Just In Time accelerator] operates. Often at the end of loops it must transfer control back to the interpreter which is an expensive operation. The “end” statements are usually where this time ends up getting assigned when profiling programs like this.”
Now we all know!
Thanks for the videos Doug. Appreciate it :)
“I really gained some knowledge from this video to find the time taken by the functions and variables”
Thanks for the videos
Hi Doug !
I’m using the profiler a lot. I want to know if there is a way to profile a mex file.The profiler treats it like a built in function.
Thank’s a lot.
If you want visibility into the C code in a mex file, you will need to use the debuging capabilities of your external development environment.
Great and excellent article t’s realy helpful. Thanks again.
Thanks for video
Excellent article it’s realy helpful, keep up the good work!
Great articles. Very interesting.
your vedio was very useful
i was also thinking that if you can give more examples of how to use matlab will help the world.
My profiler returns something like 9246494268.503 seconds of total time and self time for some functions, this is odd since i only ran the simulation for 8 seconds :-). What am I doing wrong?
A great and useful viedeo.
A big thank!
I’am experiencing the same problem as Morten L. Jorgensen.
Is their anyone familiar with this problem, and its solution?
The following bug (AMD dual core) was the cause:
A workaround is also described.
This is bug solved in R2007a.
A great and useful viedeo.
A big thank!
actually I have a problem.
The profiler shows some “if” statements that
take a lot of time, (simple ifs like if a == 1), other ifs
and ends take 6 seconds.
About end statements, I understand from previous guys
but why if statements are so slow, I just want to know if it is some kind of a bug or it is a MATLAB limitation ?
Hope to get an answer,
[comment reformatted for clarity- Doug]
I just tested this in the manner you described it. I saw no slowdown on the if statements. Please send the code into tech support and we will see what they can do for you.
Thanks for fast reply,
How can I do it via email?
[Edited for clarity- Doug]
Contact support at:
Thank you very much..I have gone through most of your videos and all are extrmely helpful.
great haircut, great picture Doug!
Mr. Doug, i’ve run my code on profiler, but nothing i can do after i find line code where the most time spent. that line code is ‘ismember’. because i don,t know what the other function work like that but faster.
i use that function to check if data from one set is member of other set.
could you help me Mr
Oh yes. Very useful vid! Thank you. And thanks for telling us how you made the video, I was searching for such a tool, too.