Optimizing MATLAB through just-in-time specialization

  • Authors:
  • Maxime Chevalier-Boisvert;Laurie Hendren;Clark Verbrugge

  • Affiliations:
  • School of Computer Science, McGill University, Montreal, QC, Canada;School of Computer Science, McGill University, Montreal, QC, Canada;School of Computer Science, McGill University, Montreal, QC, Canada

  • Venue:
  • CC'10/ETAPS'10 Proceedings of the 19th joint European conference on Theory and Practice of Software, international conference on Compiler Construction
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Scientists are increasingly using dynamic programming languages like Matlab for prototyping and implementation. Effectively compiling Matlab raises many challenges due to the dynamic and complex nature of Matlab types. This paper presents a new JIT-based approach which specializes and optimizes functions on-the-fly based on the current types of function arguments. A key component of our approach is a new type inference algorithm which uses the run-time argument types to infer further type and shape information, which in turn provides new optimization opportunities. These techniques are implemented in McVM, our open implementation of a Matlab virtual machine. As this is the first paper reporting on McVM, a brief introduction to McVM is also given. We have experimented with our implementation and compared it to several other Matlab implementations, including the Mathworks proprietary system, McVM without specialization, the Octave open-source interpreter and the McFor static compiler. The results are quite encouraging and indicate that specialization is an effective optimization—McVM with specialization outperforms Octave by a large margin and also sometimes outperforms the Mathworks implementation.