Main Content

Graphics Performance

Optimize code for improved performance


drawnowUpdate figures and process callbacks
rendererinfoGraphics renderer information
openglControl OpenGL rendering


Finding Code Bottlenecks

Use the Profiler to determine which functions contribute the most time to execution time.

What Affects Code Execution Speed

You can improve the execution speed of graphics code by minimizing the effect of two factors that contribute to total execution time.

Judicious Object Creation

Graphics objects are complex structures that store information, listen for certain events to occur, and can cause changes to other objects to accommodate their existence.

Avoid Repeated Searches for Objects

When you search for handles, MATLAB® must search the object hierarchy to find matching handles, which is time-consuming.

Screen Updates

MATLAB graphics is implemented using multiple threads of execution.

Optimize Code for Getting and Setting Graphics Properties

Certain properties have dependencies on the value of other properties.

Avoid Updating Static Data

If only a small portion of the data defining a graphics scene changes with each update of the screen, you can improve performance by updating only the data that changes.

Use Low-Level Functions for Speed

To maximize graphing performance, use low-level functions and disable certain automatic features.

Transforming Objects Efficiently

Improve performance by taking advantage of the fact that graphics hardware can apply transforms to the data.

System Requirements for Graphics

All systems support most of the common MATLAB graphics features.

Resolving Low-Level Graphics Issues

MATLAB can encounter low-level issues when creating graphics on your system.