AI helps you reading Science

AI generates interpretation videos

AI extracts and analyses the key points of the paper to generate videos automatically


pub
Go Generating

AI Traceability

AI parses the academic lineage of this thesis


Master Reading Tree
Generate MRT

AI Insight

AI extracts a summary of this paper


Weibo:
This paper analyzed the impact of the Chrome V8 compiler optimizations on JavaScript code from real websites assembled by JSBench, and found that it lags far behind the impact on popular benchmarks

Improving JavaScript performance by deconstructing the type system

PLDI, no. 6 (2014): 496-507

Cited by: 49|Views244
EI

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

Code:

Data:

0
Introduction
  • The vast majority of websites today use JavaScript [2] to implement their client-side logic.
  • The advent of mobile computing and, more recently, wearable computing means that processors necessarily have to get simpler
  • This has put a spotlight on JavaScript performance, despite hardto-optimize features such as dynamic typing.
  • Recently has it come to light that the behavior of JavaScript code in real websites is more dynamic than in these benchmarks [20, 23, 22]
  • This dynamism presents new challenges to the compiler.
  • Properties in the prototype can either be accessed via inheritance through the “child” object, or directly through the prototype property in the constructor function object
Highlights
  • The vast majority of websites today use JavaScript [2] to implement their client-side logic
  • We have discovered that, in reality, the bulk of type unpredictability in JavaScript code in websites comes from two unexpected sources: prototypes and method bindings
  • When method bindings are completely decoupled from types, inline cache hits on method calls require loading the method pointer from the object
  • Our enhancements to decouple prototypes and method bindings from object types target the dynamic JavaScript code often found in real websites
  • This paper analyzed the impact of the Chrome V8 compiler optimizations on JavaScript code from real websites assembled by JSBench, and found that it lags far behind the impact on popular benchmarks
  • V8 encodes into types two pieces of information unrelated to object structure: (1) the inherited prototype and (2) method bindings. This was done assuming that the behavior of JavaScript code mimics that of statically-typed languages, where the inherited class and method bindings cannot change once an object is created. We showed that this assumption is often false for JavaScript code used in real websites
Methods
  • Method Bindings

    The second culprit behind type unpredictability is encoding the bindings of the methods of an object into its hidden class.
  • Function bindings are encoded into hidden classes in V8 by storing the values of function properties in the hidden class itself, rather than the offsets in the object like regular properties.
  • The authors completely decouple method bindings from types by disallowing the storage of function property values in the hidden class altogether.
  • When method bindings are completely decoupled from types, inline cache hits on method calls require loading the method pointer from the object.
  • Only the binding to the syntactic function is needed for the purposes of calling a method
Results
  • The authors use the JSBench benchmark suite [21].
  • Each benchmark in JSBench records about one minute worth of user interactions on a single representative webpage from the website, starting from the page load.
  • Since JavaScript execution differs slightly from browser to browser, JSBench sometimes pairs the same website with multiple browsers.
  • The authors briefly characterize the popular benchmark suites Kraken 1.1 [4], Octane [5], and SunSpider 0.9.1 [7], to see differences with JSBench
Conclusion
  • 6.1 Impact of The authors' Compiler Modifications

    The authors' enhancements to decouple prototypes and method bindings from object types target the dynamic JavaScript code often found in real websites.
  • V8 encodes into types two pieces of information unrelated to object structure: (1) the inherited prototype and (2) method bindings
  • This was done assuming that the behavior of JavaScript code mimics that of statically-typed languages, where the inherited class and method bindings cannot change once an object is created.
  • The authors showed that this assumption is often false for JavaScript code used in real websites
Tables
  • Table1: Heap memory allocated and heap collection time for JSBench (top) and the other benchmark suites (bottom)
Download tables as Excel
Related work
  • Richards et al [23, 22] and Ratanaworabhan et al [20] have performed empirical studies to evaluate how programmers use some of the JavaScript features in real websites, as well as in some of the popular benchmark suites. These studies have shown that the popular benchmarks are different from the websites with respect to call site dynamism, the frequency of property additions and deletions after object construction, constructor polymorphism, and how programmers use eval. These works were done at the program behavioral level, and did not analyze how these behaviors impact the compiler and the resulting performance.

    Modern JavaScript engines use key ideas from SmallTalk [13] and Self [11] on how to optimize dynamically-typed, object oriented languages, such as hidden classes [11], inline caches [13], and polymorphic inline caching [15].

    There are other proposed techniques to speedup JavaScript programs that are orthogonal to the techniques discussed in this paper; they could be used together with our compiler modifications. For instance, recent works decrease overheads through program analysis, to statically infer a variable’s type [14, 16]. Another proposal extends the ISA to load and check the type with a single instruction [9]. Finally, ParaGuard [19] and ParaScript [18] propose hardware support for parallel execution of JavaScript programs. The former offloads the runtime checks to another thread while the main thread continues with the execution of the user code; the latter uses speculative parallelization to support loop-level parallelization of JavaScript programs.
Funding
  • Inheritance is supported by having the special property __proto__ in the object pointing to the prototype object at object construction time
Reference
  • Chakra. http://blogs.msdn.com/b/ie/archive/2010/03/18/the-new-javascript-engine-in-internet-explorer-9.aspx.
    Findings
  • ECMAScript. http://www.ecmascript.org/.
    Findings
  • JavaScriptCore. http://trac.webkit.org/wiki/JavaScriptCore.
    Findings
  • Kraken Benchmarks. http://krakenbenchmark.mozilla.org/.
    Findings
  • Octane Benchmarks. https://developers.google.com/octane.
    Findings
  • SpiderMonkey Project. https://developer.mozilla.org/en-
    Findings
  • SunSpider Benchmarks. http://www.webkit.org/perf/sunspider/sunspider.html.
    Findings
  • V8 JavaScript Engine. https://developers.google.com/v8/.
    Findings
  • O. Anderson, E. Fortuna, L. Ceze, and S. Eggers. Checked load: Architectural support for JavaScript type-checking on mobile processors. In HPCA, 2011.
    Google ScholarLocate open access versionFindings
  • J. Castanos, D. Edelsohn, K. Ishizaki, P. Nagpurkar, T. Nakatani, T. Ogasawara, and P. Wu. On the benefits and pitfalls of extending a statically typed language JIT compiler for dynamic scripting languages. In OOPSLA, 2012.
    Google ScholarLocate open access versionFindings
  • C. Chambers, D. Ungar, and E. Lee. An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes. In OOPSLA, 1989.
    Google ScholarLocate open access versionFindings
  • D. Clifford. Breaking the JavaScript limit with V8. http://v8-io12.appspot.com.
    Findings
  • L. P. Deutsch and A. M. Schiffman. Efficient implementation of the Smalltalk-80 system. In POPL, 1984.
    Google ScholarLocate open access versionFindings
  • B. Hackett and S.-Y. Guo. Fast and precise hybrid type inference for JavaScript. In PLDI, 2012.
    Google ScholarLocate open access versionFindings
  • U. Holzle, C. Chambers, and D. Ungar. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In ECOOP, 1991.
    Google ScholarLocate open access versionFindings
  • S. Li, B. Cheng, and X.-F. Li. TypeCastor: Demystify dynamic typing of JavaScript applications. In HiPEAC, 2011.
    Google ScholarLocate open access versionFindings
  • C.-K. Luk, R. Cohn, R. Muth, H. Patil, A. Klauser, G. Lowney, S. Wallace, V. J. Reddi, and K. Hazelwood. Pin: Building customized program analysis tools with dynamic instrumentation. In PLDI, 2005.
    Google ScholarLocate open access versionFindings
  • M. Mehrara, P.-C. Hsu, M. Samadi, and S. Mahlke. Dynamic parallelization of JavaScript applications using an ultra-lightweight speculation mechanism. In HPCA, 2011.
    Google ScholarLocate open access versionFindings
  • M. Mehrara and S. Mahlke. Dynamically accelerating clientside web applications through decoupled execution. In CGO, 2011.
    Google ScholarLocate open access versionFindings
  • P. Ratanaworabhan, B. Livshits, and B. G. Zorn. JSMeter: Comparing the behavior of JavaScript benchmarks with real Web applications. In the USENIX Conference on Web Application Development, 2010.
    Google ScholarLocate open access versionFindings
  • G. Richards, A. Gal, B. Eich, and J. Vitek. Automated construction of JavaScript benchmarks. In OOPSLA, 2011.
    Google ScholarLocate open access versionFindings
  • G. Richards, C. Hammer, B. Burg, and J. Vitek. The Eval that men do: A large-scale study of the use of Eval in JavaScript applications. In ECOOP, 2011.
    Google ScholarLocate open access versionFindings
  • G. Richards, S. Lebresne, B. Burg, and J. Vitek. An analysis of the dynamic behavior of JavaScript programs. In PLDI, 2010.
    Google ScholarLocate open access versionFindings
Your rating :
0

 

Tags
Comments
数据免责声明
页面数据均来自互联网公开来源、合作出版商和通过AI技术自动分析结果,我们不对页面数据的有效性、准确性、正确性、可靠性、完整性和及时性做出任何承诺和保证。若有疑问,可以通过电子邮件方式联系我们:report@aminer.cn
小科