Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1944862.1944873acmotherconferencesArticle/Chapter ViewAbstractPublication PageshipeacConference Proceedingsconference-collections
research-article

TypeCastor: demystify dynamic typing of JavaScript applications

Published: 24 January 2011 Publication History
  • Get Citation Alerts
  • 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.

    References

    [1]
    Peter Thiemann. Towards a type system for analyzing javascript programs. In ESOP, pages 408--422, 2005.
    [2]
    Christopher Anderson, et al. Towards type inference for JavaScript. In Proc. 19th European Conference on Object-Oriented Programming, ECOOP '05, volume 3586 of LNCS. Springer-Verlag, July 2005.
    [3]
    Simon Holm Jensen, et al. Type Analysis for JavaScript. SAS, volume 5673 of Lecture Notes in Computer Science, page 238--255. Springer, 2009
    [4]
    Mozilla Rhino. JavaScript for Java. http://www.mozilla.org/rhino/
    [5]
    Mads Sig Ager. V8 Internals. Google IO 2009, http://dl.google.com/io/2009/pres/W_1230_V8BuildingaHighPerformanceJavaScriptEngine.pdf
    [6]
    Andreas Gal, et al. Trace-based Just-in-Time Type Specialization for Dynamic Languages. In Proceedings of the ACM SIGPLAN 2009 Conference on Programming Language Design and Implementation, Dublin, Ireland, 2009.
    [7]
    Phillip Heidegger and Peter Thiemann. Recency types for dynamically-typed object-based languages. In Proc. International Workshops on Foundations of Object-Oriented Languages, FOOL '09, January 2009
    [8]
    Gogul Balakrishnan and Thomas W. Reps. Recency-abstraction for heap-allocated storage. In Kwangkeun Yi, editor, SAS, number 4134, pages 221--239. Springer, 2006.
    [9]
    Dongseok Jang and Kwang-Moo Choe. Points-to analysis for JavaScript. In Proc. 24th Annual ACM Symposium on Applied Computing, SAC '09, Programming Language Track, March 2009
    [10]
    Surfin' Safari. Announcing SquirrelFish Extreme. http://webkit.org/blog/214/introducing-squirrelfishextreme/
    [11]
    M. Berndl, et al. Context Threading: a Flexible and Efficient Dispatch Technique for Virtual Machine Interpreters. In 2005 International Symposium on Code Generation and Optimization, p. 15--26, March 2005.
    [12]
    Mozilla.org. SpiderMonkey (JavaScript-C) Engine. http://www.mozilla.org/js/spidermonkey/
    [13]
    Manuel Fähndrich, Alexander Aiken. Program Analysis Using Mixed Term and Set Constraints. Proceedings of the 4th International Symposium on Static Analysis, p. 114--126, September 08--10, 1997
    [14]
    Ecma International Organization. Standard ECMA-262 ECMAScript: A general purpose, cross-platform programming language. http://www.ecmainternational.org/publications/standards/Ecma-262.htm
    [15]
    WebKit Organization. SunSpider JavaScript Benchmark. http://www2.webkit.org/perf/sunspider-0.9/sunspider.html
    [16]
    M. Bugliesi and S. M. Pericas-Geertsen. Type inference for variant object types. Information and Computation, v. 177 n. 1, p. 2--27, 25 August 2002
    [17]
    M. Chang, et al. Efficient Just-In-Time execution of dynamically typed languages via code specialization using precise runtime type inference. Technical Report ICS-TR-07-10, Donald Bren School of Information and Computer Science, University of California, Irvine, 2007.
    [18]
    The Apache Software Foundation. Apache Harmony. http://harmony.apache.org.
    [19]
    Mozilla Corporation. SpiderMonkey Internals. https://developer.mozilla.org/En/SpiderMonkey/Internals/Property_cache
    [20]
    Chambers, Ungar, Lee. An Efficient Implementation of Self, a Dynamically-Typed Object-Oriented Language Based on Prototypes. Lisp and Symbolic Computation, 4, 3, 1991

    Cited By

    View all
    • (2017)Conventionality analysis of array objects in JavaScript2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER.2017.7884677(561-562)Online publication date: Feb-2017
    • (2014)Improving JavaScript performance by deconstructing the type systemACM SIGPLAN Notices10.1145/2666356.259433249:6(496-507)Online publication date: 9-Jun-2014
    • (2014)Improving JavaScript performance by deconstructing the type systemProceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2594291.2594332(496-507)Online publication date: 9-Jun-2014

    Index Terms

    1. TypeCastor: demystify dynamic typing of JavaScript applications

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Other conferences
      HiPEAC '11: Proceedings of the 6th International Conference on High Performance and Embedded Architectures and Compilers
      January 2011
      226 pages
      ISBN:9781450302418
      DOI:10.1145/1944862
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Sponsors

      • HiPEAC: HiPEAC Network of Excellence

      In-Cooperation

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 24 January 2011

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. JavaScript
      2. dynamic typing
      3. inline caching
      4. type analysis

      Qualifiers

      • Research-article

      Conference

      HIPEAC '11
      Sponsor:
      • HiPEAC

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)0
      • Downloads (Last 6 weeks)0
      Reflects downloads up to 11 Aug 2024

      Other Metrics

      Citations

      Cited By

      View all
      • (2017)Conventionality analysis of array objects in JavaScript2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER.2017.7884677(561-562)Online publication date: Feb-2017
      • (2014)Improving JavaScript performance by deconstructing the type systemACM SIGPLAN Notices10.1145/2666356.259433249:6(496-507)Online publication date: 9-Jun-2014
      • (2014)Improving JavaScript performance by deconstructing the type systemProceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2594291.2594332(496-507)Online publication date: 9-Jun-2014

      View Options

      Get Access

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media