[Paper Review] Fast Static Analyses of Software Product Lines -- An Example With More Than 42,000 Metrics
This paper presents a novel partial parsing technique using Reduced Abstract Syntax Trees (RASTs) to enable fast, scalable static analysis of software product lines (SPLs), supporting over 42,000 metric variants—including both traditional single-system and variability-aware metrics—on large-scale systems like the Linux kernel with sub-second per-metric performance.
Context: Software metrics, as one form of static analyses, is a commonly used approach in software engineering in order to understand the state of a software system, in particular to identify potential areas prone to defects. Family-based techniques extract variability information from code artifacts in Software Product Lines (SPLs) to perform static analysis for all available variants. Many different types of metrics with numerous variants have been defined in literature. When counting all metrics including such variants, easily thousands of metrics can be defined. Computing all of them for large product lines can be an extremely expensive process in terms of performance and resource consumption. Objective: We address these performance and resource challenges while supporting customizable metric suites, which allow running both, single system and variability-aware code metrics. Method: In this paper, we introduce a partial parsing approach used for the efficient measurement of more than 42,000 code metric variations. The approach covers variability information and restricts parsing to the relevant parts of the Abstract Syntax Tree (AST). Conclusions: This partial parsing approach is designed to cover all relevant information to compute a broad variety of variability-aware code metrics on code artifacts containing annotation-based variability, e.g., realized with C-preprocessor statements. It allows for the flexible combination of single system and variability-aware metrics, which is not supported by existing tools. This is achieved by a novel representation of partially parsed product line code artifacts, which is tailored to the computation of the metrics. Our approach consumes considerably less resources, especially when computing many metric variants in parallel.
Motivation & Objective
- Address the high computational cost of analyzing large-scale software product lines (SPLs) with thousands of code and variability-aware metrics.
- Overcome the lack of tool support for combining traditional software metrics with SPL-specific variability-aware metrics.
- Enable scalable, high-performance static analysis of SPLs by minimizing resource overhead during metric computation.
- Support flexible, customizable metric suites that allow arbitrary combinations of feature-level and code-level metrics.
- Provide a foundation for systematic evaluation of SPL metric suites, such as MetricHaven, in real-world systems.
Proposed method
- Introduce Reduced Abstract Syntax Trees (RASTs) that abstract away irrelevant syntactic details while preserving essential information for metric computation.
- Parse un-preprocessed source code directly to retain variability information, such as C-preprocessor directives, without full preprocessing.
- Construct a coarse-grained AST representation that omits non-essential language constructs, reducing memory and processing overhead.
- Compute metric values in a single pass over the RAST, leveraging CPU caching and minimizing data structure reconstruction.
- Support hybrid metric computation by integrating feature model data with code-level ASTs, enabling unified analysis of feature and code metrics.
- Design the RAST representation to be tailored specifically to the needs of common SPL metrics, excluding support for metrics like Halstead that require full AST fidelity.
Experimental results
Research questions
- RQ1What are the requirements to support a flexible measurement of single system and variability-aware code metrics?
- RQ2How can existing variability-aware metrics for code and variability models be combined effectively?
- RQ3What abstraction is required to support a scalable analysis of large-scale SPLs with high metric diversity?
Key findings
- The approach achieved a total analysis time of approximately 6 hours and 20 minutes for the entire Linux kernel, processing over 42,000 metric variants.
- On average, the system required only 0.76 seconds per metric, with a per-function metric computation time of about 0.06 seconds for 29,976 metrics.
- The RAST-based parsing reduced resource consumption significantly compared to full AST processing, especially when analyzing large numbers of metric variants in parallel.
- The framework successfully supports the flexible combination of variability-aware code metrics with feature-level metrics, a capability not available in existing tools.
- The method enables high performance and scalability, with strong caching utilization due to single-pass metric computation over the RAST.
- The approach is highly customizable, allowing significant performance improvements when reducing the number of metrics to analyze.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.