Skip to main content

Uncovering JavaScript Performance Code Smells Relevant to Type Mutations

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2015)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9458))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://groups.google.com/forum/#!topic/v8-users/Ofc_SmwDCUM.

  2. 2.

    https://github.com/kripken/emscripten.

References

  1. https://asmjs.org

  2. https://people.mozilla.org/jorendorff/es6-draft.html

  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. 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. Bolz, C.F., Diekmann, L., Tratt, L.: Storage strategies for collections in dynamically typed languages. In: OOPSLA (2013)

    Google Scholar 

  6. Feldthaus, A., Millstein, T., Møller, A., Schäfer, M., Tip, F.: Tool-supported refactoring for javascript. In: OOPSLA (2011)

    Google Scholar 

  7. Flückiger, O.: Compiled Compiler Templates for V8. Master’s thesis (2014)

    Google Scholar 

  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. 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. Gudeman, D.: Representing type information in dynamically typed languages (1993)

    Google Scholar 

  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. Hackett, B., Guo, S.Y.: Fast and precise hybrid type inference for javascript. In: PLDI (2012)

    Google Scholar 

  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. Hölzle, U., Chambers, C., Ungar, D.: Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In: ECOOP (1991)

    Google Scholar 

  15. Hölzle, U., Ungar, D.: Optimizing dynamically-dispatched calls with run-time type feedback. In: PLDI (1994)

    Google Scholar 

  16. Hölzle, U., Ungar, D.: A third-generation self implementation: reconciling responsiveness with performance. In: OOPSLA (1994)

    Google Scholar 

  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. Liu, X., Mellor-Crummey, J.: Pinpointing data locality problems using data-centric analysis. In: CGO (2011)

    Google Scholar 

  19. McCutchan, J.: Accelerating oz with v8: follow the yellow brick road to javascript performance. In: Google I/O Conference (2013)

    Google Scholar 

  20. Nistor, A., Song, L., Marinov, D., Lu, S.: Toddler: detecting performance problems via similar memory-access patterns. In: ICSE (2013)

    Google Scholar 

  21. Santos, H.N., Alves, P., Costa, I., Pereira, F.M.Q.: Just-in-time value specialization. In: CGO (2013)

    Google Scholar 

  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. 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. 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. Yan, D., Xu, G., Rountev, A.: Uncovering performance problems in java applications with reference propagation profiling. In: ICSE (2012)

    Google Scholar 

  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 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Xiao Xiao .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Xiao, X., Han, S., Zhang, C., Zhang, D. (2015). Uncovering JavaScript Performance Code Smells Relevant to Type Mutations. In: Feng, X., Park, S. (eds) Programming Languages and Systems. APLAS 2015. Lecture Notes in Computer Science(), vol 9458. Springer, Cham. https://doi.org/10.1007/978-3-319-26529-2_18

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-26529-2_18

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-26528-5

  • Online ISBN: 978-3-319-26529-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics