Optimization Coaching for JavaScript Vincent St-Amour1 and Shu-yu Guo2 1 PLT @ Northeastern University Boston, Massachusetts, USA
[email protected] 2 Mozilla Research San Francisco, California, USA
[email protected] Abstract The performance of dynamic object-oriented programming languages such as JavaScript depends heavily on highly optimizing just-in-time compilers. Such compilers, like all compilers, can si- lently fall back to generating conservative, low-performance code during optimization. As a result, programmers may inadvertently cause performance issues on users’ systems by making seemingly inoffensive changes to programs. This paper shows how to solve the problem of silent optimization failures. It specifically explains how to create a so-called optimization coach for an object-oriented just-in-time-compiled programming language. The development and evaluation build on the SpiderMonkey JavaScript engine, but the results should generalize to a variety of similar platforms. 1998 ACM Subject Classification D.2.3 [Software Engineering] Coding Tools and Techniques, D.3.4 [Programming Languages] Processors – Compilers Keywords and phrases Optimization Coaching, JavaScript, Performance Tools Digital Object Identifier 10.4230/LIPIcs.ECOOP.2015.271 Supplementary Material ECOOP Artifact Evaluation approved artifact available at http://dx.doi.org/10.4230/DARTS.1.1.5 1 Optimization Coaching for the Modern World An optimization coach [22] opens a dialog between optimizing compilers and programmers. It thus allows the latter to take full advantage of the optimization process. Specifically, coaches provide programmers with actionable recommendations of changes to their programs to trigger additional optimizations. Notably, the changes may not preserve the semantics of the program. Our experiences with a prototype optimization coach for Racket show promising results.