Asian Symposium on Programming Languages and Systems

Programming Languages and Systems pp 335-355

Uncovering JavaScript Performance Code Smells Relevant to Type Mutations

Conference paper

DOI: 10.1007/978-3-319-26529-2_18

Part of the Lecture Notes in Computer Science book series (LNCS, volume 9458)
Cite this paper as:
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. Lecture Notes in Computer Science, vol 9458. Springer, Cham


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.

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