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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Aguilera, M.K., Mogul, J.C., Wiener, J.L., Reynolds, P., Muthitacharoen, A.: Performance debugging for distributed systems of black boxes. In: SOSP (2003)
Ahn, W., Choi, J., Shull, T., Garzarán, M.J., Torrellas, J.: Improving javascript performance by deconstructing the type system. In: PLDI (2014)
Bolz, C.F., Diekmann, L., Tratt, L.: Storage strategies for collections in dynamically typed languages. In: OOPSLA (2013)
Feldthaus, A., Millstein, T., Møller, A., Schäfer, M., Tip, F.: Tool-supported refactoring for javascript. In: OOPSLA (2011)
Flückiger, O.: Compiled Compiler Templates for V8. Master’s thesis (2014)
Fu, Q., Lou, J.G., Wang, Y., Li, J.: Execution anomaly detection in distributed systems through unstructured log analysis. In: ICDM (2009)
Gong, L., Pradel, M., Sen, K.: JITprof: pinpointing JIT-unfriendly javascript code. In: Proceedings of ESEC/FSE, pp. 357–368. ACM (2015)
Gudeman, D.: Representing type information in dynamically typed languages (1993)
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)
Hackett, B., Guo, S.Y.: Fast and precise hybrid type inference for javascript. In: PLDI (2012)
Han, S., Dang, Y., Ge, S., Zhang, D., Xie, T.: Performance debugging in the large via mining millions of stack traces. In: ICSE (2012)
Hölzle, U., Chambers, C., Ungar, D.: Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In: ECOOP (1991)
Hölzle, U., Ungar, D.: Optimizing dynamically-dispatched calls with run-time type feedback. In: PLDI (1994)
Hölzle, U., Ungar, D.: A third-generation self implementation: reconciling responsiveness with performance. In: OOPSLA (1994)
Kedlaya, M.N., Roesch, J., Robatmili, B., Reshadi, M., Hardekopf, B.: Improved type specialization for dynamic scripting languages. In: DLS (2013)
Liu, X., Mellor-Crummey, J.: Pinpointing data locality problems using data-centric analysis. In: CGO (2011)
McCutchan, J.: Accelerating oz with v8: follow the yellow brick road to javascript performance. In: Google I/O Conference (2013)
Nistor, A., Song, L., Marinov, D., Lu, S.: Toddler: detecting performance problems via similar memory-access patterns. In: ICSE (2013)
Santos, H.N., Alves, P., Costa, I., Pereira, F.M.Q.: Just-in-time value specialization. In: CGO (2013)
Van Cutsem, T., Miller, M.S.: Traits.js: robust object composition and high-integrity objects for ecmascript 5. In: PLASTIC (2011)
Xu, G., Arnold, M., Mitchell, N., Rountev, A., Sevitsky, G.: Go with the flow: profiling copies to find runtime bloat. In: PLDI (2009)
Xu, W., Huang, L., Fox, A., Patterson, D., Jordan, M.I.: Detecting large-scale system problems by mining console logs. In: SOSP (2009)
Yan, D., Xu, G., Rountev, A.: Uncovering performance problems in java applications with reference propagation profiling. In: ICSE (2012)
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)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights 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)