skip to main content
research-article
Open Access
Artifacts Evaluated & Functional / v1.1

Hidden inheritance: an inline caching design for TypeScript performance

Published:13 November 2020Publication History
Skip Abstract Section

Abstract

TypeScript is a dynamically typed language widely used to develop large-scale applications nowadays. These applications are usually designed with complex class or interface hierarchies and have highly polymorphic behaviors. These object-oriented (OO) features will lead to inefficient inline caches (ICs) or trigger deoptimizations, which impact the performance of TypeScript applications.

To address this problem, we introduce an inline caching design called hidden inheritance (HI). The basic idea of HI is to cache the static information of class or interface hierarchies into hidden classes, which are leveraged to generate efficient inline caches for improving the performance of OO-style TypeScript programs. The HI design is implemented in a TypeScript engine STSC (Static TypeScript Compiler) including a static compiler and a runtime system. STSC statically generates hidden classes and enhanced inline caches, which are applied to generate specialized machine code via ahead-of-time compilation (AOTC) or just-in-time compilation (JITC). To evaluate the efficiency of this technique, we implement STSC on a state-of-the-art JavaScript virtual machine V8 and demonstrate its performance improvements on industrial benchmarks and applications.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This video gives an introduction of the work of hidden inheritance, which is published in OOPSLA-2020. Hidden inheritance is a technique developed by Alibaba group. It is to solve the inline cache missing problem stem from type polymorphism in OOP-style typescript programs. The key idea of hidden inheritance is to extract the type hierarchy information from typescript program and build hidden inheritance relationship between the types, after that, the conventional inline cache can be enhanced to take into account the hidden inheritance relationship between types (hidden classes), rather than just check if the types are identical. A TypeScript virtual machine called STSC is developed with hidden inheritance technique. STSC can significantly improve the performance of OOP-style typescript program, both in JIT mode or AOT mode.

References

  1. Angular2. 2017. Google Angular JS Framework. https://developers.google.com/v8/.Google ScholarGoogle Scholar
  2. Apple. 2018. JavaScriptCore. https://github.com/WebKit/webkit/tree/master/Source/JavaScriptCore.Google ScholarGoogle Scholar
  3. Artoul. 2015. Javascript Hidden Classes and Inline Caching in V8. http://richardartoul.github.io/jekyll/update/ 2015 /04/26/ hidden-classes.html..Google ScholarGoogle Scholar
  4. Thomas Ball, Peli de Halleux, and Michał Moskal. 2019. Static TypeScript: An Implementation of a Static Compiler for the TypeScript Language. In Proceedings of the 16th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes (MPLR 2019 ). Association for Computing Machinery, New York, NY, USA, 105-116. https: //doi.org/10.1145/3357390.3361032 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Bevenius. 2018. Learning Google V8. https://github.com/danbev/learning-v8..Google ScholarGoogle Scholar
  6. Jose Castanos, David Edelsohn, Kazuaki Ishizaki, Priya Nagpurkar, Toshio Nakatani, Takeshi Ogasawara, and Peng Wu. 2012. On the Benefits and Pitfalls of Extending a Statically Typed Language JIT Compiler for Dynamic Scripting Languages. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA '12). ACM, New York, NY, USA, 195-212.Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Chambers, D. Ungar, and E. Lee. 1989. An Eficient Implementation of SELF a Dynamically-typed Object-oriented Language Based on Prototypes. In Conference Proceedings on Object-oriented Programming Systems, Languages and Applications (OOPSLA '89). ACM, New York, NY, USA, 49-70.Google ScholarGoogle Scholar
  8. Jiho Choi, Thomas Shull, and Josep Torrellas. 2019. Reusable Inline Caching for JavaScript Performance. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2019 ). ACM, New York, NY, USA, 889-901.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Clif Click and Michael Paleczny. 1995. A Simple Graph-based Intermediate Representation. In Papers from the 1995 ACM SIGPLAN Workshop on Intermediate Representations (IR '95). ACM, New York, NY, USA, 35-49.Google ScholarGoogle Scholar
  10. John Rose Clif Click. 2002. Fast subtype checking in the HotSpot JVM. In Proceedings of the 2002 joint ACM-ISCOPE conference on Java (JGI 2002 ). ACM, New York, NY, USA, 96-107.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Daniel Cliford, Hannes Payer, Michael Stanton, and Ben L. Titzer. 2015. Memento Mori: Dynamic Allocation-site-based Optimizations. In Proceedings of the 2015 International Symposium on Memory Management (ISMM '15). ACM, New York, NY, USA, 105-117.Google ScholarGoogle Scholar
  12. L. Peter Deutsch and Allan M. Schifman. 1984. Eficient Implementation of the Smalltalk-80 System. In Proceedings of the 11th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL '84). ACM, New York, NY, USA, 297-302.Google ScholarGoogle Scholar
  13. Egret-3d. 2017. Egret 3D Game Engine. https://github.com/egret-labs/egret-core.Google ScholarGoogle Scholar
  14. Facebook. 2013. React.js Framework. https://reactjs.org/.Google ScholarGoogle Scholar
  15. Ben Frederickson. 2015. Ranking. https://www.benfrederickson. com/ranking-programming-languages-by-github-users/.Google ScholarGoogle Scholar
  16. Google. 2015. Code Caching. https://v8.dev/blog/code-caching.Google ScholarGoogle Scholar
  17. Google-V8. 2019. V8 JavaScript Engine. https://developers.google.com/v8/.Google ScholarGoogle Scholar
  18. Urs Hölzle, Craig Chambers, and David Ungar. 1991. Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP '91). Springer-Verlag, London, UK, UK, 21-38.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. IDE-VSCode. 2017. Microsoft Visual Studio Code-Open Source. https://github.com/Microsoft/vscode.Google ScholarGoogle Scholar
  20. Microsoft. 2014. TypeScript Specification. http://www.typescriptlang.org/.Google ScholarGoogle Scholar
  21. Microsoft. 2018. ChakraCore. https://github.com/Microsoft/ChakraCore.Google ScholarGoogle Scholar
  22. NativeScript. 2017. NativeScript: A Framework of Native Mobile Applications. https://github.com/nativescript.Google ScholarGoogle Scholar
  23. HyukWoo Park, SungKook Kim, and Soo-Mook Moon. 2017. Advanced Ahead-of-time Compilation for Javascript Engine: Work-in-progress. In Proceedings of the 2017 International Conference on Compilers, Architectures and Synthesis for Embedded Systems Companion (CASES '17). ACM, New York, NY, USA, Article 16, 2 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Gregor Richards, Sylvain Lebresne, Brian Burg, and Jan Vitek. 2010. An Analysis of the Dynamic Behavior of JavaScript Programs. In Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '10). Association for Computing Machinery, New York, NY, USA, 1-12. https://doi.org/10.1145/1806596.1806598 Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Gregor Richards, Francesco Zappa Nardelli, and Jan Vitek. 2015. Concrete Types for TypeScript. In 29th European Conference on Object-Oriented Programming (ECOOP 2015 ) (Leibniz International Proceedings in Informatics (LIPIcs)), John Tang Boyland (Ed.), Vol. 37. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 76-100. https://doi.org/ 10.4230/LIPIcs.ECOOP. 2015.76 Google ScholarGoogle ScholarCross RefCross Ref
  26. Manuel Serrano. 2018. JavaScript AOT Compilation. In Proceedings of the 14th ACM SIGPLAN International Symposium on Dynamic Languages (DLS 2018 ). ACM, New York, NY, USA, 50-63.Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Manuel Serrano and Marc Feeley. 2019. Property Caches Revisited. In Proceedings of the 28th International Conference on Compiler Construction (CC 2019 ). ACM, New York, NY, USA, 99-110.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Stackoverflow. 2017. Programming Languages. https://insights.stackoverflow.com/survey/2017technology.Google ScholarGoogle Scholar
  29. Superpowers. 2018. Superpowers. https://github.com/superpowers/superpowers-core.Google ScholarGoogle Scholar
  30. Tiobe. 2020. Programming Languages. https://www.tiobe.com/tiobe-index/.Google ScholarGoogle Scholar
  31. Vue.js. 2019. Vue.js Framework. https://github.com/vuejs/vue-next.Google ScholarGoogle Scholar
  32. WebKit. 2019. JetStream2 Benchmarks. https://github.com/WebKit/webkit/tree/master/PerformanceTests/JetStream2.Google ScholarGoogle Scholar

Index Terms

  1. Hidden inheritance: an inline caching design for TypeScript performance

        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

        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!