Skip to main content
QUICK REVIEW

[Paper Review] Static JavaScript Call Graphs: A Comparative Study

Gábor Antal, Péter Hegedűs|arXiv (Cornell University)|May 12, 2024
Web Data Mining and AnalysisComputer Science8 citations
TL;DR

The paper empirically compares five static JavaScript call graph tools across SunSpider benchmarks and Node.js modules, showing notable precision differences and that tool combinations can cover most true edges while remaining precise.

ABSTRACT

The popularity and wide adoption of JavaScript both at the client and server side makes its code analysis more important than ever before. Most of the algorithms for vulnerability analysis, coding issue detection, or type inference rely on the call graph representation of the underlying program. Despite some obvious advantages of dynamic analysis, static algorithms should also be considered for call graph construction as they do not require extensive test beds for programs and their costly execution and tracing. In this paper, we systematically compare five widely adopted static algorithms - implemented by the npm call graph, IBM WALA, Google Closure Compiler, Approximate Call Graph, and Type Analyzer for JavaScript tools - for building JavaScript call graphs on 26 WebKit SunSpider benchmark programs and 6 real-world Node.js modules. We provide a performance analysis as well as a quantitative and qualitative evaluation of the results. We found that there was a relatively large intersection of the found call edges among the algorithms, which proved to be 100 precise. However, most of the tools found edges that were missed by all others. ACG had the highest precision followed immediately by TAJS, but ACG found significantly more call edges. As for the combination of tools, ACG and TAJS together covered 99% of the found true edges by all algorithms, while maintaining a precision as high as 98%. Only two of the tools were able to analyze up-to-date multi-file Node.js modules due to incomplete language features support. They agreed on almost 60% of the call edges, but each of them found valid edges that the other missed.

Motivation & Objective

  • Assess the capabilities and performance of five widely used static JavaScript call graph tools.
  • Quantitatively compare the edges and nodes produced by each tool on benchmark and real-world inputs.
  • Qualitatively analyze true/false edges via manual validation and identify strengths/limitations of each tool.
  • Provide guidance on tool combinations that maximize coverage with high precision.

Proposed method

  • Select five open-source static JS call graph tools (npm callgraph, WALA, Closure Compiler, ACG, TAJS) and adapt outputs to a unified JSON format.
  • Run tools on three input groups: SunSpider benchmarks (26 single-file programs), six multi-file Node.js modules, and generated large JS programs.
  • Patch tools as needed to produce consistent JSON call graph representations and resolve edge duplicates and missing target info.
  • Merge individual tool outputs into a combined JSON with edge-tool provenance for comparison.
  • Manually validate a representative sample of edges (and all edges for SunSpider) to determine true positives/false positives.

Experimental results

Research questions

  • RQ1What are the precision and recall characteristics of each static call graph tool on JavaScript programs?
  • RQ2How much do tool outputs agree on detected call edges, and which edges are uniquely identified by particular tools?
  • RQ3Can combinations of tools achieve high coverage of true edges while maintaining high precision, and what are the trade-offs?
  • RQ4How do tools perform on real-world multi-file Node.js modules compared to single-file benchmarks?

Key findings

  • ACG achieves the highest precision (above 99% of its reported edges are true) and also the highest recall over the union of true edges found by all tools (over 90%).
  • TAJS achieves a precision of about 98% but does not find any unique edges in SunSpider, while not reaching ACG’s edge count.
  • There is a relatively large intersection of edges among tools, with 93 edges found by all five tools and all of them being true positives.
  • Some tools (WALA, Closure, npm-cg) report many edges that are not found by others, but many are false positives, highlighting tool-specific biases (e.g., global-scope calls, dynamic constructs).
  • Combining ACG and TAJS (and to some extent Closure) covers around 99% of true edges found by all tools while maintaining a precision near 98%.
  • Performance and memory usage vary by input size; Closure and TAJS excel in runtime, and ACG and Closure tend to use more memory for realistic inputs, with only Closure/TAJS/ACG remaining practical for very large inputs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.