TypeCastor: demystify dynamic typing of JavaScript applications

  • Authors:
  • Shisheng Li;Buqi Cheng;Xiao-Feng Li

  • Affiliations:
  • Intel China Research Center, China;Intel China Research Center, China;Intel China Research Center, China

  • Venue:
  • Proceedings of the 6th International Conference on High Performance and Embedded Architectures and Compilers
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Dynamic typing is a barrier for JavaScript applications to achieve high performance. Compared with statically typed languages, the major overhead of dynamic typing comes from runtime type resolution and runtime property lookup. Common folks' belief is that the traditional static compilation techniques are no longer effective for dynamic languages. The best known JavaScript engines such as Mozilla TraceMonkey and Chrome V8 have developed non-traditional techniques to reduce the runtime overhead. This paper describes TypeCastor, a new JavaScript engine that tries to investigate where and how much the dynamism really is in JavaScript applications, thus to demystify their dynamic typing behavior. To verify our findings, we evaluate TypeCastor with SunSpider benchmark. For type resolution, we find 99% of all the primitive type instances can be statically identified before the program execution. For object property lookup, more than 97% of all runtime property accesses can be satisfied by inline cache. These data mean that the representative JavaScript applications are not that dynamic as people expect, although the language provides the flexible dynamism supports. Though not developed for pure performance, TypeCastor achieves 5.6% and 12.7% higher scores compared to current Chrome V8 and Mozilla TraceMonkey engines respectively.