Asian Symposium on Programming Languages and Systems

Programming Languages and Systems pp 335-355 | Cite as

Uncovering JavaScript Performance Code Smells Relevant to Type Mutations

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9458)

Abstract

In dynamic typing languages such as JavaScript, object types can be mutated easily such as by adding a field to an object. However, compiler optimizations rely on a fixed set of types, unintentional type mutations can invalidate the speculative code generated by the type-feedback JIT and deteriorate the quality of compiler optimizations. Since type mutations are invisible, finding and understanding the performance issues relevant to type mutations can be an overwhelming task to programmers. We develop a tool JSweeter to detect performance bugs incurred by type mutations based on the type evolution graphs extracted from program execution. We apply JSweeter to the Octane benchmark suite and identify 46 performance issues, where 19 issues are successfully fixed with the refactoring hints generated by JSweeter and the average performance gain is 5.3 % (up to 23 %). The result is persuasive because those issues are hidden in such well developed benchmark programs.

References

  1. 1.
  2. 2.
  3. 3.
    Aguilera, M.K., Mogul, J.C., Wiener, J.L., Reynolds, P., Muthitacharoen, A.: Performance debugging for distributed systems of black boxes. In: SOSP (2003)Google Scholar
  4. 4.
    Ahn, W., Choi, J., Shull, T., Garzarán, M.J., Torrellas, J.: Improving javascript performance by deconstructing the type system. In: PLDI (2014)Google Scholar
  5. 5.
    Bolz, C.F., Diekmann, L., Tratt, L.: Storage strategies for collections in dynamically typed languages. In: OOPSLA (2013)Google Scholar
  6. 6.
    Feldthaus, A., Millstein, T., Møller, A., Schäfer, M., Tip, F.: Tool-supported refactoring for javascript. In: OOPSLA (2011)Google Scholar
  7. 7.
    Flückiger, O.: Compiled Compiler Templates for V8. Master’s thesis (2014)Google Scholar
  8. 8.
    Fu, Q., Lou, J.G., Wang, Y., Li, J.: Execution anomaly detection in distributed systems through unstructured log analysis. In: ICDM (2009)Google Scholar
  9. 9.
    Gong, L., Pradel, M., Sen, K.: JITprof: pinpointing JIT-unfriendly javascript code. In: Proceedings of ESEC/FSE, pp. 357–368. ACM (2015)Google Scholar
  10. 10.
    Gudeman, D.: Representing type information in dynamically typed languages (1993)Google Scholar
  11. 11.
    Guo, Z., Zhou, D., Lin, H., Yang, M., Long, F., Deng, C., Liu, C., Zhou, L.: G2: a graph processing system for diagnosing distributed systems. In: USENIXATC (2011)Google Scholar
  12. 12.
    Hackett, B., Guo, S.Y.: Fast and precise hybrid type inference for javascript. In: PLDI (2012)Google Scholar
  13. 13.
    Han, S., Dang, Y., Ge, S., Zhang, D., Xie, T.: Performance debugging in the large via mining millions of stack traces. In: ICSE (2012)Google Scholar
  14. 14.
    Hölzle, U., Chambers, C., Ungar, D.: Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In: ECOOP (1991)Google Scholar
  15. 15.
    Hölzle, U., Ungar, D.: Optimizing dynamically-dispatched calls with run-time type feedback. In: PLDI (1994)Google Scholar
  16. 16.
    Hölzle, U., Ungar, D.: A third-generation self implementation: reconciling responsiveness with performance. In: OOPSLA (1994)Google Scholar
  17. 17.
    Kedlaya, M.N., Roesch, J., Robatmili, B., Reshadi, M., Hardekopf, B.: Improved type specialization for dynamic scripting languages. In: DLS (2013)Google Scholar
  18. 18.
    Liu, X., Mellor-Crummey, J.: Pinpointing data locality problems using data-centric analysis. In: CGO (2011)Google Scholar
  19. 19.
    McCutchan, J.: Accelerating oz with v8: follow the yellow brick road to javascript performance. In: Google I/O Conference (2013)Google Scholar
  20. 20.
    Nistor, A., Song, L., Marinov, D., Lu, S.: Toddler: detecting performance problems via similar memory-access patterns. In: ICSE (2013)Google Scholar
  21. 21.
    Santos, H.N., Alves, P., Costa, I., Pereira, F.M.Q.: Just-in-time value specialization. In: CGO (2013)Google Scholar
  22. 22.
    Van Cutsem, T., Miller, M.S.: Traits.js: robust object composition and high-integrity objects for ecmascript 5. In: PLASTIC (2011)Google Scholar
  23. 23.
    Xu, G., Arnold, M., Mitchell, N., Rountev, A., Sevitsky, G.: Go with the flow: profiling copies to find runtime bloat. In: PLDI (2009)Google Scholar
  24. 24.
    Xu, W., Huang, L., Fox, A., Patterson, D., Jordan, M.I.: Detecting large-scale system problems by mining console logs. In: SOSP (2009)Google Scholar
  25. 25.
    Yan, D., Xu, G., Rountev, A.: Uncovering performance problems in java applications with reference propagation profiling. In: ICSE (2012)Google Scholar
  26. 26.
    Yuan, D., Mai, H., Xiong, W., Tan, L., Zhou, Y., Pasupathy, S.: Sherlog: error diagnosis by connecting clues from run-time logs. In: ASPLOS XV (2010)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Xiao Xiao
    • 1
  • Shi Han
    • 2
  • Charles Zhang
    • 1
  • Dongmei Zhang
    • 2
  1. 1.The Hong Kong University of Science and TechnologyHong KongHong Kong
  2. 2.Microsoft ResearchBeijingChina

Personalised recommendations