Improving JavaScript performance by deconstructing the type system

Wonsun Ahn, Jiho Choi, Thomas Shull, María J. Garzarán, Josep Torrellas

Research output: Contribution to journalArticlepeer-review

Abstract

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%.

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.

Original languageEnglish (US)
Pages (from-to)496-507
Number of pages12
JournalACM SIGPLAN Notices
Volume49
Issue number6
DOIs
StatePublished - Jun 5 2014

Keywords

  • Dynamic typing
  • Hidden class
  • Inline caching
  • JavaScript
  • Prototype
  • Scripting language
  • Type specialization

ASJC Scopus subject areas

  • General Computer Science

Fingerprint

Dive into the research topics of 'Improving JavaScript performance by deconstructing the type system'. Together they form a unique fingerprint.

Cite this