bench - MATLAB benchmark - MATLAB (original) (raw)

Main Content

Syntax

Description

[t](#mw%5Fd5c0d3b7-99a6-4ab2-9c7e-02694580dd8b) = bench measures the execution time of five different benchmarking tasks on your computer and compares the results to several benchmark computers. The function:

Note

A benchmark is intended to compare the performance of one particular MATLAB® release on different computers. It does not offer direct comparisons between different MATLAB releases because tasks and problem sizes can change from release to release.

example

[t](#mw%5Fd5c0d3b7-99a6-4ab2-9c7e-02694580dd8b) = bench([N](#mw%5F6c7fa792-3907-4175-a46d-a0bbe5779996)) runs each of the five tasks N times and returns an N-by-5 array with the execution times. If N is zero, the function does not run any of the tasks on your computer but instead displays the execution times for other computers and compares their speeds.

Fluctuations of 5–10% in the measured times of repeated runs on a single computer are typical.

Examples

collapse all

Measure the execution time of the five benchmarking tasks on your computer and compare the results to other benchmark computers.

Figure MATLAB Benchmark contains an axes object. The axes object with title Relative Speed contains 2 objects of type bar.

Figure MATLAB Benchmark (times in seconds) contains objects of type uicontrol.

t = 1×5

0.3552    0.2182    0.2089    2.1751    1.7931

Input Arguments

collapse all

Number of times to run the five tasks, specified as a nonnegative integer.

Output Arguments

collapse all

Measured execution times, returned as an N-by-5 vector, whereN is the number of times the benchmarking tasks ran. The measured values are expressed in seconds.

More About

collapse all

This table describes the five benchmarking tasks.

Task Description Performance Factors
LU Perform the LU factorization of a full matrix using lu. Floating-point values, regular memory access
FFT Perform the fast Fourier transform of a full vector using fft. Floating-point values, irregular memory access
ODE Solve the van der Pol equation using ode45. Data structures and MATLAB function files
Sparse Solve a symmetric sparse linear syste using mldivide. Mixed-integer and floating-point values
Graphics Update a variety of graphics objects to animate in a loop. Line, scatter, surface, and image objects

The LU and FFT tasks involve large matrices and long vectors.

The Graphics task measures graphics performance, including support for hardware-accelerated graphics. The rendererinfo function provides information about the graphics renderer implementation that MATLAB uses. For example, this command gets the information for the current axes and stores it in a structure named info.

Version History

Introduced in R2008a

expand all

The existing 2-D and 3-D tasks have been replaced by a single Graphics benchmarking task. The new Graphics task is a better benchmark for the updated graphics system, which uses more modern architecture, and represents a wider range of graphics workflows.

This table compares the R2024b and R2025a execution times using a Windows® 11 Enterprise, Intel® Core i9-12900 @ 2.4GHz test system. The measured values are expressed in seconds.

Task Execution Times of Tasks in R2024b Execution Times of Tasks in R2025a
LU 0.2384 0.2408
FFT 0.1538 0.1535
ODE 0.0830 0.0858
Sparse 0.2112 0.2090
2-D 0.1485 Not applicable
3-D 0.2100 Not applicable
Graphics Not applicable 0.1342

Problem sizes have increased for the numerical computation tasks (LU, FFT, ODE, and Sparse) so that the ranking of computers using bench test results are not dominated by the 2-D and 3-D graphics tasks. In previous releases, the 2-D and 3-D tasks take significantly longer to complete compared to the numerical computation tasks and therefore contribute disproportionately to the ranking of computers.

This table shows different task execution times in R2020a using a Windows 10, Intel Xeon® W-2133 @ 3.60 GHz test system. The measured values are expressed in seconds.

Task Execution Times of New Problem Sizes Execution Times of Old Problem Sizes
LU 0.388 0.068
FFT 0.312 0.112
ODE 0.480 0.015
Sparse 0.488 0.103
2-D 0.301 0.307
3-D 0.296 0.303