Improving JavaScript performance by deconstructing the type system
Authors:
Open Access
- 5 June 2014
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 49 (6) , 496-507
Abstract
Increased focus on JavaScript performance has resulted in vast performance improvements for many benchmarks. However, for actual code used in websites, the attained improvements often lag far behind those for popular benchmarks. This paper shows that the main reason behind this short-fall is how the compiler understands types. JavaScript has no concept of types, but the compiler assigns types to objects anyway for ease of code generation. We examine the way that the Chrome V8 compiler defines types, and identify two design decisions that are the main reasons for the lack of improvement: (1) the inherited prototype object is part of the current object's type definition, and (2) method bindings are also part of the type definition. These requirements make types very unpredictable, which hinders type specialization by the compiler. Hence, we modify V8 to remove these requirements, and use it to compile the JavaScript code assembled by JSBench from real websites. On average, we reduce the execution time of JSBench by 36%, and the dynamic instruction count by 49%.Keywords
Funding Information
- Division of Computer and Network Systems (CCF-1012759, CNS-1116237, CNS-1319657)
- Division of Computing and Communication Foundations (CCF-1012759, CNS-1116237, CNS-1319657)
- University of Illinois at Urbana-Champaign
This publication has 8 references indexed in Scilit:
- On the benefits and pitfalls of extending a statically typed language JIT compiler for dynamic scripting languages2012
- Fast and precise hybrid type inference for JavaScript2012
- Automated construction of JavaScript benchmarks2011
- TypeCastor2011
- An analysis of the dynamic behavior of JavaScript programs2010
- Pin2005
- An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes1989
- Efficient implementation of the smalltalk-80 system1984