skip to main content
10.1145/2508168.2508177acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Improved type specialization for dynamic scripting languages

Authors Info & Claims
Published:28 October 2013Publication History

ABSTRACT

Type feedback and type inference are two common methods used to optimize dynamic languages such as JavaScript. Each of these methods has its own strengths and weaknesses, and we propose that each can benefit from the other if combined in the right way. We explore the interdependency between these two methods and propose two novel ways to combine them in order to significantly increase their aggregate benefit and decrease their aggregate overhead. In our proposed strategy, an initial type inference pass is applied that can reduce type feedback overhead by enabling more intelligent placement of profiling hooks. This initial type inference pass is novel in the literature. After profiling, a final type inference pass uses the type information from profiling to generate efficient code. While this second pass is not novel, we significantly improve its effectiveness in a novel way by feeding the type inference pass information about the function signature, i.e., the types of the function's arguments for aspecific function invocation. Our results show significant speedups when using these low-overhead strategies, ranging from 1.2x to 4x over an implementation that does not perform type feedback or type inference based optimizations. Our experiments are carried out across a wide range of traditional benchmarks and realistic web applications. The results also show an average reduction of 23.5% in the size of the profiled data for these benchmarks.

References

  1. Google closure compiler. https://developers.google.com/closure/compiler.Google ScholarGoogle Scholar
  2. Js1k. http://js1k.com.Google ScholarGoogle Scholar
  3. Jscrush minifier. http://www.iteral.com/jscrush.Google ScholarGoogle Scholar
  4. Kraken benchmark suite. http://krakenbenchmark.mozilla.org.Google ScholarGoogle Scholar
  5. Sunspider benchmark suite. http://www.webkit.org/perf/sunspider/sunspider.html.Google ScholarGoogle Scholar
  6. V8 benchmark suite. http://v8.googlecode.com/svn/data/benchmarks/v7/README.txt.Google ScholarGoogle Scholar
  7. O. Agesen. Concrete type inference: delivering object-oriented applications. PhD thesis, Stanford, CA, USA, 1996. UMI Order No. GAX96-20452. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. O. Agesen and U. Hölzle. Type feedback vs. concrete type inference: A comparison of optimization techniques for object-oriented languages. In ACM SIGPLAN Notices, volume 30, pages 91--107. ACM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. Arnold and B. G. Ryder. A framework for reducing the cost of instrumented code. In Proceedings of the ACM SIGPLAN 2001 conference on Programming language design and implementation, PLDI '01, pages 168--179, New York, NY, USA, 2001. ACM. ISBN 1-58113-414-2. URL http://doi.acm.org/10. 1145/378795.378832. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Arnold, S. J. Fink, D. Grove, M. Hind, and P. F. Sweeney. A survey of adaptive optimization in virtual machines. In Proceedings of the IEEE, 93(2), 2005. special issue on program generatation, optimization, and adaptations, 2004.Google ScholarGoogle Scholar
  11. D. G. Bobrow, L. G. DeMichiel, R. P. Gabriel, S. E. Keene, G. Kiczales, and D. A. Moon. Common lisp object system specification. ACM Sigplan Notices, 23(SI):1--142, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: Pypy's tracing jit compiler. In Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 18--25. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. F. Bolz, A. Cuni, M. Fijalkowski, M. Leuschel, S. Pedroni, and A. Rigo. Runtime feedback in a meta-tracing jit for efficient dynamic languages. In Proceedings of the 6th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems, page 9. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. C. Cascaval, S. Fowler, P. Montesinos-Ortego, W. Piekarski, M. Reshadi, B. Robatmili, M. Weber, and V. Bhavsar. Zoomm: a parallel web browser engine for multicore mobile devices. In Proceedings of the 18th ACM SIGPLAN symposium on Principles and practice of parallel programming, PPoPP '13, pages 271--280, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-1922-5. URL http://doi.acm.org/10.1145/2442516.2442543. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. C. Chambers. The design and implementation of the self compiler, an optimizing compiler for object-oriented programming languages. PhD thesis, Stanford University, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C. Chambers and G. T. Leavens. Typechecking and modules for multimethods. ACM Transactions on Programming Languages and Systems (TOPLAS), 17(6): 805--843, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Crankshaft compiler. V8 engine. http://www.jayconrod.com/posts/54/a-tour-of-v8-crankshaft-the-optimizing-compiler, 2013.Google ScholarGoogle Scholar
  18. B. Hackett and S.-y. Guo. Fast and precise hybrid type inference for javascript. In Proceedings of the 33rd ACM SIGPLAN conference on Programming Language Design and Implementation, pages 239--250. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. U. Hölzle. Adaptive optimization for SELF: reconciling high performance with exploratory programming. PhD thesis, Stanford University, 1995.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. U. Hölzle and D. Ungar. Optimizing dynamically-dispatched calls with run-time type feedback. ACM SIGPLAN Notices, 29(6):326--336, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. U. Hölzle and D. Ungar. Reconciling responsiveness with performance in pure object-oriented languages. ACM Trans. Program. Lang. Syst., 18(4):355--400, July 1996. ISSN 0164-0925. . URL http://doi.acm.org/10.1145/233561.233562. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Mono. Xamarian Inc. Mono. http://www.mono-project.com/Main_Page, 2013.Google ScholarGoogle Scholar
  23. PyPy. PyPy Status Blog. http://morepypy.blogspot.com,2013.Google ScholarGoogle Scholar
  24. Rubinius. Rubinius Blog. http://rubini.us/blog, 2013.Google ScholarGoogle Scholar
  25. v8. Google Inc. V8 JavaScript virtual machine. https://code.google.com/p/v8, 2013.Google ScholarGoogle Scholar

Index Terms

  1. Improved type specialization for dynamic scripting languages

    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
    • Published in

      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

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 28 October 2013

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      DLS '13 Paper Acceptance Rate9of22submissions,41%Overall Acceptance Rate32of77submissions,42%

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader