This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

What Affects Code Execution Speed

Potential Bottlenecks

Performance becomes an issue when working with large amounts of data and large numbers of objects. In such cases, you can improve the execution speed of graphics code by minimizing the effect of two factors that contribute to total execution time:

  • Object creation — Adding new graphics objects to a scene.

  • Screen updates — Updating the graphics model and sending changes to be rendered.

It is often possible to prevent these activities from dominating the total execution time of a particular programming pattern. Think of execution time as being the sum of a number of terms:

T execution time = T creating objects + T updating + (T calculations, etc)

The examples that follow show ways to minimize the time spent in object creation and updating the screen. In the preceding expression, the execution time does not include time spent in the actual rendering of the screen.

How to Improve Performance

Profile your code and optimize algorithms, calculation, and other bottlenecks that are specific to your application. Then determine if the code is taking more time in object creation functions or drawnow (updating). You can begin to optimize both operations, beginning with the larger term in the total time equation.

Is your code: