skip to main content
research-article

Server-side type profiling for optimizing client-side JavaScript engines

Published:21 October 2015Publication History
Skip Abstract Section

Abstract

Modern JavaScript engines optimize hot functions using a JIT compiler along with type information gathered by an online profiler. However, the profiler's information can be unsound and when unexpected types are encountered the engine must recover using an expensive mechanism called deoptimization. In this paper we describe a method to significantly reduce the number of deoptimizations observed by client-side JavaScript engines by using ahead-of-time profiling on the server-side. Unlike previous work on ahead-of-time profiling for statically-typed languages such as Java, our technique must operate on a dynamically-typed language, which significantly changes the required insights and methods to make the technique effective. We implement our proposed technique using the SpiderMonkey JavaScript engine, and we evaluate our implementation using three different kinds of benchmarks: the industry-standard Octane benchmark suite, a set of JavaScript physics engines, and a set of real-world websites from the Membench50 benchmark suite. We show that using ahead-of-time profiling provides significant performance benefits over the baseline vanilla SpiderMonkey engine.

References

  1. Spidermonkey baseline compiler. https://wiki.mozilla.org/ Javascript:SpiderMonkey:BaselineCompiler, 2015.Google ScholarGoogle Scholar
  2. Common language runtime. http://msdn.microsoft.com/ en-us/library/8bs2ecf4(v=vs.110).aspx, 2015.Google ScholarGoogle Scholar
  3. Java virtual machine. http://docs.oracle.com/javase/specs/ jvms/se7/html/, 2015.Google ScholarGoogle Scholar
  4. Matter.js - a 2d rigid body javascript physics engine. http://brm. io/matter-js/, 2015.Google ScholarGoogle Scholar
  5. Membench50. http://gregor-wagner.com/tmp/mem50, 2015.Google ScholarGoogle Scholar
  6. Mozilla central repository. https://hg.mozilla.org/ mozilla-central, 2015.Google ScholarGoogle Scholar
  7. Octane benchmark suite. https://developers.google.com/ octane/, 2015.Google ScholarGoogle Scholar
  8. Physics.js physics engine. http://wellcaffeinated.net/ PhysicsJS/, 2015.Google ScholarGoogle Scholar
  9. pixi.js 3d rendering engine. http://www.pixijs.com, 2015.Google ScholarGoogle Scholar
  10. Selenium ide. http://docs.seleniumhq.org/docs/02_ selenium_ide.jsp, 2015.Google ScholarGoogle Scholar
  11. three.js physics engine. http://threejs.org, 2015.Google ScholarGoogle Scholar
  12. M. Arnold, S. Fink, D. Grove, M. Hind, and P. F. Sweeney. Adaptive optimization in the jalapeno jvm. In Proceedings of the 15th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. M. Arnold, A. Welc, and V. T. Rajan. Improving virtual machine performance using a cross-run profile repository. In Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. asm.js specification. asm.js specification. http://asmjs.org/spec/ latest/, 2015.Google ScholarGoogle Scholar
  15. C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the metalevel: Pypy’s tracing jit compiler. In Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Closure Compiler. Google Inc. closure compiler. https:// developers.google.com/closure/compiler/, 2015.Google ScholarGoogle Scholar
  17. Crankshaft compiler. V8 engine. http://www.jayconrod.com/posts/54/ a-tour-of-v8-crankshaft-the-optimizing-compiler, 2015.Google ScholarGoogle Scholar
  18. Flow. Flow static type checker. http://flowtype.org, 2015.Google ScholarGoogle Scholar
  19. L. Guckert, M. OConnor, S. Kumar Ravindranath, Z. Zhao, and V. Janapa Reddi. A case for persistent caching of compiled javascript code in mobile web browsers. In In Workshop on Architectural and Microarchitectural Support for Binary Translation, 2013.Google ScholarGoogle Scholar
  20. U. Hölzle and D. Ungar. A third-generation self implementation: reconciling responsiveness with performance. In Proceedings of the ninth annual conference on Object-oriented programming systems, language, and applications, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. U. Hölzle, C. Chambers, and D. Ungar. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In Proceedings of the European Conference on Object-Oriented Programming, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN 1992 conference on Programming language design and implementation, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. JavaScriptCore. Webkit JavaScriptCore virtual machine. http: //trac.webkit.org/wiki/JavaScriptCore, 2015.Google ScholarGoogle Scholar
  24. C. Krintz. Coupling on-line and off-line profile information to improve program performance. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. C. Krintz and B. Calder. Using annotations to reduce dynamic optimization time. In Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. J. Oh and S.-M. Moon. Snapshot-based loading-time acceleration for web applications. In Proceedings of the 13th Annual IEEE/ACM International Symposium on Code Generation and Optimization, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. M. Paleczny, C. Vick, and C. Click. The java hotspot server compiler. In Proceedings of the 2001 Symposium on JavaTM Virtual Machine Research and Technology Symposium - Volume 1, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. SpiderMonkey. SpiderMonkey JavaScript Engine. http://www. mozilla.org/js/spidermonkey/, 2015.Google ScholarGoogle Scholar
  29. TypeScript. Typescript. http://www.typescriptlang.org, 2015.Google ScholarGoogle Scholar
  30. V8. Google Inc. V8 JavaScript virtual machine. https://code. google.com/p/v8, 2015.Google ScholarGoogle Scholar

Index Terms

  1. Server-side type profiling for optimizing client-side JavaScript engines

    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 51, Issue 2
      DLS '15
      Feburary 2016
      176 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2936313
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        DLS 2015: Proceedings of the 11th Symposium on Dynamic Languages
        October 2015
        176 pages
        ISBN:9781450336901
        DOI:10.1145/2816707

      Copyright © 2015 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 21 October 2015

      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!