Optimizing MATLAB feval with dynamic techniques

  • Authors:
  • Nurudeen A. Lameed;Laurie J. Hendren

  • Affiliations:
  • McGill University, Montreal, Quebec, Canada;McGill University, Montreal, Quebec, Canada

  • Venue:
  • Proceedings of the 9th symposium on Dynamic languages
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

MATLAB is a popular dynamic array-based language used by engineers, scientists and students worldwide. The built-in function feval is an important MATLAB feature for certain classes of numerical programs and solvers which benefit from having functions as parameters. Programmers may pass a function name or function handle to the solver and then the solver uses feval to indirectly call the function. In this paper, we show that there are significant performance overheads for function calls via feval, in both MATLAB interpreters and JITs. The paper then proposes, implements and compares two on-the-fly mechanisms for specialization of feval calls. The first approach uses on-stack replacement technology, as supported by McVM/McOSR. The second approach specializes calls of functions with feval using a combination of runtime input argument types and values. Experimental results on seven numerical solvers show that the techniques provide good performance improvements.