MATLAB Execution Engine

Run your programs faster with the redesigned MATLAB® execution engine in R2015b or later.

The improved architecture uses just-in-time (JIT) compilation of all MATLAB code with a single execution pathway. The engine offers improved language quality and provides a platform for future enhancements.

Specific performance improvements include those made to:

Function Calls

Function call overhead is greatly reduced such that there is no longer an appreciable performance penalty for organizing code into many small functions.

Object-Oriented Features

Many object-oriented operations execute faster. Object-oriented programming can improve code readability, reusability, and maintainability. MATLAB code that makes heavy use of object-oriented programming executes faster due to the engine’s improved architecture.

Element-Wise Math Operations

The execution of many element-wise math operations is optimized. These operations are element-by-element arithmetic operations on arrays such as the following:

>> b = ((a+1).*a)./(5-a);

User Application Performance Improvements

76 performance-sensitive user applications were tested. The average performance improvement across all tests was 40%. Tests consisted of code that used a range of MATLAB products. Although not all applications ran faster with the redesign, the majority of these applications ran at least 10% faster in R2015b than in R2015a.

Axis labels in the figure indicate the ratio of execution times in R2015a and R2015b for applications running on Windows PCs. The best of three runs was used to determine the execution time, excluding an initial warm up run. Any clear all statements were removed to ensure code was not cleared between runs.

Just-in-Time Compilation of All MATLAB Code

The redesigned MATLAB execution engine uses JIT compilation of all MATLAB code, whereas the execution engine previously used JIT compilation in some cases. The JIT compilation generates native machine level code that is optimized for the MATLAB code being executed and for the specific hardware platform.

The performance benefit of JIT compilation is greatest when MATLAB code is executed additional times and can re-use the compiled code. This happens in common cases such as for-loops or when applications are run additional times in a MATLAB session with at least some of the application’s MATLAB files remaining unmodified between subsequent runs.

Performance tips

  1. Use clear to clear variables, not clear all, which also clears code.
  2. Modularize applications into multiple MATLAB files.

How Fast Is Your Code?

Test your code with the redesigned MATLAB execution engine by downloading and installing R2015b or later. You'll be taking advantage of the MATLAB execution engine as soon as you start running your code. For tips on improving code performance, see Techniques for Improving Performance. And to learn more about assessing the performance of your code, see Measure Performance of Your Program.