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.
- LLVM. http://www.llvm.org/.Google Scholar
- G. Almási and D. Padua. MaJIC: Compiling MATLAB for Speed and Responsiveness. In PLDI '02, pages 294--303, New York, USA, 2002. ACM. Google Scholar
Digital Library
- B. Alpern, S. Augart, S. M. Blackburn, M. Butrico, A. Cocchi, P. Cheng, J. Dolby, S. Fink, D. Grove, M. Hind, K. S. McKinley, M. Mergen, J. E. B. Moss, T. Ngo, and V. Sarkar. The Jikes Research Virtual Machine Project: Building an Open-Source Research Community. IBM Syst. J., 44(2):399--417, 2005. Google Scholar
Digital Library
- C. Chambers and D. Ungar. Making Pure Object-Oriented Languages Practical. In OOPSLA '91, pages 1--15, 1991. Google Scholar
Digital Library
- M. Chevalier-Boisvert, L. Hendren, and C. Verbrugge. Optimizing MATLAB through Just-In-Time Specialization. In CC '10, pages 46--65, 2010. Google Scholar
Digital Library
- L. P. Deutsch and A. M. Schiffman. Efficient Implementation of the Smalltalk-80 System. In POPL '84, pages 297--302, New York, NY, USA, 1984. ACM. Google Scholar
Digital Library
- S. J. Fink and F. Qian. Design, Implementation and Evaluation of Adaptive Recompilation with On-stack Replacement. In CGO '03, pages 241--252, 2003. Google Scholar
Digital Library
- A. Goldberg and D. Robson. Smalltalk-80: The Language and its Implementation. Addison-Wesley, 2 edition, 1985.Google Scholar
- U. Hölzle, C. Chambers, and D. Ungar. Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches. In ECOOP '91, pages 21--38, London, UK, UK, 1991. Springer-Verlag. Google Scholar
Digital Library
- U. Hölzle, C. Chambers, and D. Ungar. Debugging Optimized Code with Dynamic Deoptimization. In PLDI '92, pages 32--43, 1992. Google Scholar
Digital Library
- U. Hölzle and D. Ungar. A Third-Generation SELF Implementation: Reconciling Responsiveness with Performance. In OOPSLA '94, pages 229--243, 1994. Google Scholar
Digital Library
- G. Krasner. Smalltalk-80: Bits of History, Words of Advice. Addison-Wesley, 1983. Google Scholar
Digital Library
- N. Lameed. McOSR: A Tool for Supporting On-Stack Replacement (OSR) in LLVM, 2012. http://www.sable.mcgill.ca/mclab/mcosr/.Google Scholar
- N. Lameed and L. Hendren. A Modular Approach to On-Stack Replacement in LLVM. In VEE '13, pages 143--154, 2013. Google Scholar
Digital Library
- C. Lattner and V. Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In CGO '04, pages 75--86, 2004. Google Scholar
Digital Library
- McLAB. The McVM Virtual Machine and its JIT Compiler, 2012. http://www.sable.mcgill.ca/mclab/mcvm_mcjit.html.Google Scholar
- H. R. Nielson and F. Nielson. Using Transformations in the Implementation of Higher-Order Functions. Journal of Functional Programming, 1:459--494, 1991.Google Scholar
Cross Ref
- M. Paleczny, C. Vick, and C. Click. The Java HotSpot Server Compiler. In JVM'01, pages 1--12, 2001. Google Scholar
Digital Library
- G. Recktenwald. Numerical Methods with MATLAB: Implementations and Applications. Prentice Hall, 2000. Google Scholar
Digital Library
- G. Recktenwald. Numerical Methods with MATLAB: Implementations and Applications (Source Code Distribution), 2000. http://web.cecs.pdx.edu/?gerry/nmm/mfiles. Google Scholar
Digital Library
- S. Soman and C. Krintz. Efficient and General On-Stack Replacement for Aggressive Program Specialization. In Software Engineering Research and Practice, pages 925--932, 2006.Google Scholar
- The Mathworks. Technology Backgrounder: Accelerating MATLAB, September 2002. http://www.mathworks.com/company/newsletters/digest/sept02/accel_matlab.pdf.Google Scholar
- D. Ungar and D. Patterson. What Price Smalltalk? Computer, 20(1):67--74, Jan. 1987. Google Scholar
Digital Library
- D. M. Ungar. The Design and Evaluation of a High Performan Google Scholar
Digital Library
Index Terms
Optimizing MATLAB feval with dynamic techniques
Recommendations
Optimizing MATLAB feval with dynamic techniques
DLS '13: Proceedings of the 9th symposium on Dynamic languagesMATLAB 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 ...
A modular approach to on-stack replacement in LLVM
VEE '13On-stack replacement (OSR) is a technique that allows a virtual machine to interrupt running code during the execution of a function/method, to re-optimize the function on-the-fly using an optimizing JIT compiler, and then to resume the interrupted ...
A modular approach to on-stack replacement in LLVM
VEE '13: Proceedings of the 9th ACM SIGPLAN/SIGOPS international conference on Virtual execution environmentsOn-stack replacement (OSR) is a technique that allows a virtual machine to interrupt running code during the execution of a function/method, to re-optimize the function on-the-fly using an optimizing JIT compiler, and then to resume the interrupted ...







Comments