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.
Supplemental Material
- Angular2. 2017. Google Angular JS Framework. https://developers.google.com/v8/.Google Scholar
- Apple. 2018. JavaScriptCore. https://github.com/WebKit/webkit/tree/master/Source/JavaScriptCore.Google Scholar
- Artoul. 2015. Javascript Hidden Classes and Inline Caching in V8. http://richardartoul.github.io/jekyll/update/ 2015 /04/26/ hidden-classes.html..Google Scholar
- 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 Scholar
Digital Library
- Bevenius. 2018. Learning Google V8. https://github.com/danbev/learning-v8..Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- Egret-3d. 2017. Egret 3D Game Engine. https://github.com/egret-labs/egret-core.Google Scholar
- Facebook. 2013. React.js Framework. https://reactjs.org/.Google Scholar
- Ben Frederickson. 2015. Ranking. https://www.benfrederickson. com/ranking-programming-languages-by-github-users/.Google Scholar
- Google. 2015. Code Caching. https://v8.dev/blog/code-caching.Google Scholar
- Google-V8. 2019. V8 JavaScript Engine. https://developers.google.com/v8/.Google Scholar
- 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 Scholar
Digital Library
- IDE-VSCode. 2017. Microsoft Visual Studio Code-Open Source. https://github.com/Microsoft/vscode.Google Scholar
- Microsoft. 2014. TypeScript Specification. http://www.typescriptlang.org/.Google Scholar
- Microsoft. 2018. ChakraCore. https://github.com/Microsoft/ChakraCore.Google Scholar
- NativeScript. 2017. NativeScript: A Framework of Native Mobile Applications. https://github.com/nativescript.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Stackoverflow. 2017. Programming Languages. https://insights.stackoverflow.com/survey/2017technology.Google Scholar
- Superpowers. 2018. Superpowers. https://github.com/superpowers/superpowers-core.Google Scholar
- Tiobe. 2020. Programming Languages. https://www.tiobe.com/tiobe-index/.Google Scholar
- Vue.js. 2019. Vue.js Framework. https://github.com/vuejs/vue-next.Google Scholar
- WebKit. 2019. JetStream2 Benchmarks. https://github.com/WebKit/webkit/tree/master/PerformanceTests/JetStream2.Google Scholar
Index Terms
Hidden inheritance: an inline caching design for TypeScript performance






Comments