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.

Performance Testing Framework

Measure performance of MATLAB® code

You can use the MATLAB performance testing framework to measure the performance of your MATLAB code. The framework includes performance measurement-oriented features such as running your code several times to warm it up and accounting for noise in the measurements.

The performance test interface leverages the script, function, and class-based unit testing interfaces. Therefore, you can perform qualifications within your performance tests to ensure correct functional behavior while measuring code performance. Also, you can run your performance tests as standard regression tests to ensure that code changes do not break performance tests.

To get started, see Overview of Performance Testing Framework.

Functions

runperfRun set of tests for performance measurement
testsuiteCreate suite of tests

Classes

matlab.perftest.TimeExperimentInterface for measuring execution time of code under test
matlab.perftest.FixedTimeExperimentTimeExperiment that collects fixed number of measurements
matlab.perftest.FrequentistTimeExperimentTimeExperiment that collects variable number of measurements
matlab.perftest.TestCaseSuperclass of matlab.perftest performance test classes
matlab.unittest.measurement.MeasurementResultResult of measuring test suite

Topics

Overview of Performance Testing Framework

The performance test interface leverages the unit testing interfaces. Perform qualifications within your performance tests to ensure correct functional behavior while measuring code performance. Run your performance tests as standard regression tests to ensure that code changes do not break performance tests.

Test Performance Using Scripts or Functions

This example shows how to create a script or function-based performance test.

Test Performance Using Classes

This example shows how to create a class-based performance test and regression test.

Measure Fast Executing Test Code

To automatically loop through fast test code, use the matlab.perftest.TestCase.keepMeasuring method.

Related Information