Addressing JavaScript JIT Engines Performance Quirks: A Crowdsourced Adaptive Compiler

  • Rafael Auler
  • Edson Borin
  • Peli de Halleux
  • Michał Moskal
  • Nikolai Tillmann
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8409)


JavaScript has long outpaced its original target applications, being used not only for coding complex web clients, but also web servers, game development and even desktop applications. The most appealing advantage of moving applications to JavaScript is its capability to run the same code in a large number of different devices. It is not surprising that many compilers target JavaScript as an intermediate language. However, writing optimizations and analyses passes for a compiler that emits JavaScript is challenging: a long time spent in optimizing the code in a certain way can be excellent for some browsers, but a futile effort for others. For example, we show that applying JavaScript code optimizations in a tablet with Windows 8 and Internet Explorer 11 increased performance by, on average, 5 times, while running in a desktop with Windows 7 and Firefox decreased performance by 20%. Such a scenario demands a radical new solution for the traditional compiler optimization flow. This paper proposes collecting web clients performance data to build a crowdsourced compiler flag suggestion system in the cloud that helps the compiler perform the appropriate optimizations for each client platform. Since this information comes from crowdsourcing rather than manual investigations, fruitless or harmful optimizations are automatically discarded. Our approach is based on live measurements done while clients use the application on real platforms, proposing a new paradigm on how optimizations are tested.


Adaptive compilation JavaScript engines just-in-time compilation 


  1. 1.
  2. 2.
    Google Web Toolkit Page,
  3. 3.
  4. 4.
    The Computer Language Benchmarks Game,
  5. 5.
    The Dart Language Web Page,
  6. 6.
  7. 7.
    The TypeScript Language Web Page,
  8. 8.
    The WebKit Open Source Project,
  9. 9.
    V8 JavaScript Engine,
  10. 10.
    Adve, V., Lattner, C., Brukman, M., Shukla, A., Gaeke, B.: LLVA: A low-level virtual instruction set architecture. In: MICRO 36 (2003)Google Scholar
  11. 11.
    Appel, A.W.: Compiling with continuations. Cambridge University Press, New York (1992)Google Scholar
  12. 12.
    Bebenita, M., Brandner, F., Fahndrich, M., Logozzo, F., Schulte, W., Tillmann, N., Venter, H.: SPUR: A trace-based JIT compiler for CIL. In: OOPSLA 2010. ACM (2010)Google Scholar
  13. 13.
    Cavazos, J., O’Boyle, M.F.P.: Method-specific dynamic compilation using logistic regression. In: OOPSLA 2006. ACM (2006)Google Scholar
  14. 14.
    Cooper, K.D., Grosul, A., Harvey, T.J., Reeves, S., Subramanian, D., Torczon, L., Waterman, T.: Acme: Adaptive compilation made efficient. In: LCTES 2005 (2005)Google Scholar
  15. 15.
    Free Software Foundation, Inc. Using the GNU compiler collection, For GCC version 4.9.0. (March 2013)Google Scholar
  16. 16.
    Fursin, G., Miranda, C., Temam, O., Namolaru, M., Yom-Tov, E., Zaks, A., Mendelson, B., Bonilla, E., Thomson, J., Leather, H., et al.: MILEPOST GCC: Machine learning based research compiler. In: GCC Summit (2008)Google Scholar
  17. 17.
    Gizas, A., Christodoulou, S.P., Papatheodorou, T.S.: Comparative evaluation of javascript frameworks. In: 21st International Conference Companion on World Wide Web (2012)Google Scholar
  18. 18.
    Guthaus, M.R., Ringenberg, J.S., Ernst, D., Austin, T.M., Mudge, T., Brown, R.B.: MiBench: A free, commercially representative embedded benchmark suite. In: IISWC 2001. IEEE (2001)Google Scholar
  19. 19.
    Haneda, M., Knijnenburg, P.M., Wijshoff, H.A.: Automatic selection of compiler options using non-parametric inferential statistics. In: PaCT 2005. IEEE (2005)Google Scholar
  20. 20.
    Hoste, K., Georges, A., Eeckhout, L.: Automated just-in-time compiler tuning. In: CGO 2010. ACM (2010)Google Scholar
  21. 21.
    Jeon, S., Choi, J.: Reuse of JIT compiled code in JavaScript engine. In: 27th Annual ACM Symposium on Applied Computing (2012)Google Scholar
  22. 22.
    Lee, S.-W., Moon, S.-M.: Selective just-in-time compilation for client-side mobile javascript engine. In: CASES 2011. ACM (2011)Google Scholar
  23. 23.
    Lee, S.-W., Moon, S.-M., Kim, W.-J., Jin Oh, S., Oh, H.-S.: Code size and performance optimization for mobile JavaScript just-in-time compiler. In: 2010 Workshop on Interaction between Compilers and Computer Architecture (2010)Google Scholar
  24. 24.
    Martinsen, J.K., Grahn, H., Isberg, A.: Using speculation to enhance javascript performance in web applications. IEEE Internet Computing 17(2), 10–19, 3 (2013)Google Scholar
  25. 25.
    Pan, Z., Eigenmann, R.: Fast and effective orchestration of compiler optimizations for automatic performance tuning. In: CGO 2006. ACM (2006)Google Scholar
  26. 26.
    Pekhimenko, G., Brown, A.D.: Efficient program compilation through machine learning techniques. Software Automatic Tuning: From Concepts to State-of-the-Art Results, 335 (2010)Google Scholar
  27. 27.
    Richards, G., Gal, A., Eich, B., Vitek, J.: Automated construction of javascript benchmarks. In: OOPSLA 2011. ACM (2011)Google Scholar
  28. 28.
    Tilkov, S., Vinoski, S.: Node.js: Using JavaScript to Build High-Performance Network Programs. IEEE Internet Computing 14(6), 80–83 (2010)CrossRefGoogle Scholar
  29. 29.
    Tillmann, N., Moskal, M., de Halleux, J., Fahndrich, M.: TouchDevelop: Programming cloud-connected mobile devices via touchscreen. In: ONWARD 2011. ACM (2011)Google Scholar
  30. 30.
    Zakai, A.: Emscripten: An LLVM-to-JavaScript compiler. In: SPLASH 2011. ACM (2011)Google Scholar
  31. 31.
    Zhu, Y., Reddi, V.J.: High-performance and energy-efficient mobile web browsing on big/little systems. In: HPCA 2013. IEEE (2013)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  • Rafael Auler
    • 1
  • Edson Borin
    • 1
  • Peli de Halleux
    • 2
  • Michał Moskal
    • 2
  • Nikolai Tillmann
    • 2
  1. 1.University of CampinasBrazil
  2. 2.Microsoft ResearchRedmondUSA

Personalised recommendations