Main Content

Create and Run Performance Tests

Use the performance testing framework to measure the performance of your 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.


runperfRun set of tests for performance measurement
testsuiteCreate suite of tests


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.TestCaseClass for writing tests with performance testing framework
matlab.perftest.TimeResultResult from running time experiment
matlab.unittest.measurement.DefaultMeasurementResultDefault implementation of MeasurementResult class
matlab.unittest.measurement.MeasurementResultBase class for classes holding measurement results
matlab.unittest.measurement.chart.ComparisonPlotVisually compare two sets of time experiment results (Since R2019b)


Related Information