Stuart’s MATLAB Videos

Watch and Learn

Speeding up User Interfaces in MATLAB with profiler 4

Posted by Doug Hull,

Sometimes when you are working on a User Interface you want to use the profiler to speed up the code. However, with a UI so much time can be spent by the user rather than the code of interest that the timing is not as precise as would be preferred.

I like this technique so that I can do ad hock timings as needed in a complicated User Interface in MATLAB.

4 CommentsOldest to Newest

Hi Doug,

In my experience many Matlab programmers are surprisingly unaware that they can turn profiling on and off at will, interactively or programmatically, while a Matlab program is running. Doing so can significantly improve our profiling and performance-tuning effectiveness.

I don’t normally use dedicated GUI controls, since this “soils” my GUI, and I’d need to update the layout. Instead, I typically just run

profile on; ... profile off; profile report"

from the Command Prompt just before starting the workflow-to-be-analyzed. Simpler still, I click the “Start/Stop profiling” button in the Profiler tool. Another simpler alternative is to create two simple shortcuts in the Desktop that start/stop profiling respectively. This obviates the need to update numerous different GUIs separately.

In a related note, I often use the technique of selective workflow profiling to understand how a customer’s GUI behaves and works. I start profiling, interact with a specific GUI part, and then stop profiling and look at the detailed report to see what the code did in this time. It is then easy to step right into the relevant part and start coding/fixing. Customers are often surprised how quickly I can understand and fix their code, when it’s really just the selective use of the Profiler… Let’s keep this trade secret between us, shall we? :-)

I am curjous to find out what blog system you have been utilizing?

I’m having some small security issues with my latest blog and I’d like to fimd something
mpre safeguarded. Do you have any suggestions?

Add A Comment

What is 5 + 6?

Preview: hide