skip to main content
research-article

Optimizing MATLAB feval with dynamic techniques

Published:28 October 2013Publication History
Skip Abstract Section

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.

References

  1. LLVM. http://www.llvm.org/.Google ScholarGoogle Scholar
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. C. Chambers and D. Ungar. Making Pure Object-Oriented Languages Practical. In OOPSLA '91, pages 1--15, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. Chevalier-Boisvert, L. Hendren, and C. Verbrugge. Optimizing MATLAB through Just-In-Time Specialization. In CC '10, pages 46--65, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. Goldberg and D. Robson. Smalltalk-80: The Language and its Implementation. Addison-Wesley, 2 edition, 1985.Google ScholarGoogle Scholar
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. U. Hölzle, C. Chambers, and D. Ungar. Debugging Optimized Code with Dynamic Deoptimization. In PLDI '92, pages 32--43, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. U. Hölzle and D. Ungar. A Third-Generation SELF Implementation: Reconciling Responsiveness with Performance. In OOPSLA '94, pages 229--243, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. G. Krasner. Smalltalk-80: Bits of History, Words of Advice. Addison-Wesley, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. N. Lameed. McOSR: A Tool for Supporting On-Stack Replacement (OSR) in LLVM, 2012. http://www.sable.mcgill.ca/mclab/mcosr/.Google ScholarGoogle Scholar
  14. N. Lameed and L. Hendren. A Modular Approach to On-Stack Replacement in LLVM. In VEE '13, pages 143--154, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. C. Lattner and V. Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In CGO '04, pages 75--86, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. McLAB. The McVM Virtual Machine and its JIT Compiler, 2012. http://www.sable.mcgill.ca/mclab/mcvm_mcjit.html.Google ScholarGoogle Scholar
  17. H. R. Nielson and F. Nielson. Using Transformations in the Implementation of Higher-Order Functions. Journal of Functional Programming, 1:459--494, 1991.Google ScholarGoogle ScholarCross RefCross Ref
  18. M. Paleczny, C. Vick, and C. Click. The Java HotSpot Server Compiler. In JVM'01, pages 1--12, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. G. Recktenwald. Numerical Methods with MATLAB: Implementations and Applications. Prentice Hall, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. G. Recktenwald. Numerical Methods with MATLAB: Implementations and Applications (Source Code Distribution), 2000. http://web.cecs.pdx.edu/?gerry/nmm/mfiles. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle Scholar
  22. The Mathworks. Technology Backgrounder: Accelerating MATLAB, September 2002. http://www.mathworks.com/company/newsletters/digest/sept02/accel_matlab.pdf.Google ScholarGoogle Scholar
  23. D. Ungar and D. Patterson. What Price Smalltalk? Computer, 20(1):67--74, Jan. 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. D. M. Ungar. The Design and Evaluation of a High Performan Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Optimizing MATLAB feval with dynamic techniques

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 49, Issue 2
      DLS '13
      February 2014
      105 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2578856
      Issue’s Table of Contents
      • cover image ACM Conferences
        DLS '13: Proceedings of the 9th symposium on Dynamic languages
        October 2013
        118 pages
        ISBN:9781450324335
        DOI:10.1145/2508168

      Copyright © 2013 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 28 October 2013

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!