Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

What things can I do to increase the speed and memory performance of my MATLAB code?


Date Last Modified: Thursday, July 2, 2009
Solution ID:   1-15NM7
Product:   MATLAB
Reported in Release:   No Release
Platform:   All Platforms
Operating System:   All OS
 

Subject:

What things can I do to increase the speed and memory performance of my MATLAB code?

Problem Description:

I would like to increase the speed of execution of my MATLAB code.

Solution:

The following provides information on tools within MATLAB that can help you optimize the performance of your code.

1. The first step is to analyze the performance of your MATLAB code in its current state. The following is a link to the documentation regarding this topic:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f8-790895.html

In particular, the MATLAB Profiler measures where a program spends time and generates a summary. By using the Profiler, you can determine which commands and which lines of code are taking the longest to execute, and therefore determine where you can focus most of your optimization efforts. To read about how to use the MATLAB Profiler to improve performance, please see the following link:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f9-17018.html

2. There is a section in the documentation that discusses best practices for writing highly efficient code, including when and how to vectorize, how to preallocate memory for arrays,

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f8-784135.html

3. Multithreading comes default enabled in the most recent version of MATLAB. A resource explaining Multithreading in MATLAB can be found at the following link:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/brdo29n-1.html

Common mathematical operations are programmed to make use to multithreading. For a list of the affected functions, please see related solution link at the bottom of this page.

To find out if the Parallel Computing Toolbox can help make best use of a multiple core desktop or a computing cluster, navigate to the following link:

http://www.mathworks.com/access/helpdesk/help/toolbox/distcomp/f3-6010.html

 

Related Solutions:

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page