Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article
Open access

Hidden inheritance: an inline caching design for TypeScript performance

Published: 13 November 2020 Publication History

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.

Supplementary Material

Auxiliary Presentation Video (oopsla20main-p194-p-video.mp4)
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/.
[2]
Apple. 2018. JavaScriptCore. https://github.com/WebKit/webkit/tree/master/Source/JavaScriptCore.
[3]
Artoul. 2015. Javascript Hidden Classes and Inline Caching in V8. http://richardartoul.github.io/jekyll/update/ 2015 /04/26/ hidden-classes.html.
[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
[5]
Bevenius. 2018. Learning Google V8. https://github.com/danbev/learning-v8.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[13]
Egret-3d. 2017. Egret 3D Game Engine. https://github.com/egret-labs/egret-core.
[14]
Facebook. 2013. React.js Framework. https://reactjs.org/.
[15]
Ben Frederickson. 2015. Ranking. https://www.benfrederickson. com/ranking-programming-languages-by-github-users/.
[16]
Google. 2015. Code Caching. https://v8.dev/blog/code-caching.
[17]
Google-V8. 2019. V8 JavaScript Engine. https://developers.google.com/v8/.
[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.
[19]
IDE-VSCode. 2017. Microsoft Visual Studio Code-Open Source. https://github.com/Microsoft/vscode.
[20]
Microsoft. 2014. TypeScript Specification. http://www.typescriptlang.org/.
[21]
Microsoft. 2018. ChakraCore. https://github.com/Microsoft/ChakraCore.
[22]
NativeScript. 2017. NativeScript: A Framework of Native Mobile Applications. https://github.com/nativescript.
[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.
[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
[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
[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.
[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.
[28]
Stackoverflow. 2017. Programming Languages. https://insights.stackoverflow.com/survey/2017technology.
[29]
Superpowers. 2018. Superpowers. https://github.com/superpowers/superpowers-core.
[30]
Tiobe. 2020. Programming Languages. https://www.tiobe.com/tiobe-index/.
[31]
Vue.js. 2019. Vue.js Framework. https://github.com/vuejs/vue-next.
[32]
WebKit. 2019. JetStream2 Benchmarks. https://github.com/WebKit/webkit/tree/master/PerformanceTests/JetStream2.

Cited By

View all
  • (2023)RPER Software - A Social Management Tool for Rapid Participatory Emancipatory Research: Planning, Design and ImplementationRevista de Gestão Social e Ambiental10.24857/rgsa.v17n10-00317:10(e04201)Online publication date: 5-Oct-2023
  • (2023)Enhancing embedded systems development with TSAutomated Software Engineering10.1007/s10515-023-00404-x31:1Online publication date: 6-Dec-2023
  • (2022)Profile Guided Offline Optimization of Hidden Class Graphs for JavaScript VMs in Embedded SystemsProceedings of the 14th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3563838.3567678(25-35)Online publication date: 29-Nov-2022
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 4, Issue OOPSLA
November 2020
3108 pages
EISSN:2475-1421
DOI:10.1145/3436718
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 13 November 2020
Published in PACMPL Volume 4, Issue OOPSLA

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. AOTC
  2. Hidden Classes
  3. Inline Caches
  4. JITC
  5. JavaScript
  6. STSC
  7. TypeScript

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)358
  • Downloads (Last 6 weeks)30
Reflects downloads up to 22 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2023)RPER Software - A Social Management Tool for Rapid Participatory Emancipatory Research: Planning, Design and ImplementationRevista de Gestão Social e Ambiental10.24857/rgsa.v17n10-00317:10(e04201)Online publication date: 5-Oct-2023
  • (2023)Enhancing embedded systems development with TSAutomated Software Engineering10.1007/s10515-023-00404-x31:1Online publication date: 6-Dec-2023
  • (2022)Profile Guided Offline Optimization of Hidden Class Graphs for JavaScript VMs in Embedded SystemsProceedings of the 14th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3563838.3567678(25-35)Online publication date: 29-Nov-2022
  • (2021)Dancing Waltz with GhostsProceedings of the 20th International Conference on Information Processing in Sensor Networks (co-located with CPS-IoT Week 2021)10.1145/3412382.3458258(77-92)Online publication date: 18-May-2021

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media