Introduction
Predicting the execution time of software components without physical execution—often referred to as static performance estimation—remains a significant challenge in software engineering. Execution time is influenced by a complex interplay of source code logic, hardware specifications, operating system scheduling, and input parameters. While predicting absolute performance for general-purpose applications has historically yielded poor results, the domain of modern DevOps presents a more tractable opportunity: functional tests.
In Continuous Integration and Continuous Delivery (CI/CD) pipelines, long-running test suites are a primary bottleneck. If developers could receive immediate performance feedback while writing a test case, they could optimize code or prioritize tests more effectively before a single line is executed. This paper introduces TEP-GNN, a novel approach that leverages Graph Neural Networks (GNNs) to predict Java unit test runtimes by analyzing their structural and semantic properties.
Methodology
TEP-GNN moves beyond simple syntax analysis by representing source code as a rich, multi-edged graph. The pipeline consists of two primary innovations in code representation and model architecture.
Flow-Augmented Abstract Syntax Trees (FA-AST)
A standard Abstract Syntax Tree (AST) captures the hierarchical structure of code but fails to represent the movement of data or the sequence of execution. TEP-GNN enriches the AST with "semantic" edges to create a Flow-Augmented AST (FA-AST):
- Next Token/Sibling Edges: These capture the linear instruction order.
- Next Use Edges: These link variable declarations to their subsequent usages, explicitly modeling data flow.
- Control Flow Edges: Specific edges are added for
if,while, andforloops to represent branching logic and potential iteration.
Higher-Order GNN Architecture
While many software-related GNN studies utilize Gated Graph Neural Networks (GGNN), TEP-GNN employs GraphConv. This architecture is more adept at capturing "neighborhood" information across nodes, allowing the model to learn complex structural patterns within the dense FA-AST. The model architecture features three convolutional layers, followed by global max pooling and a regression head that outputs a normalized execution time estimate.
Experimental Design
To ensure real-world applicability, the researchers avoided synthetic datasets. Instead, they harvested execution traces from GitHub Actions across four diverse, large-scale Java projects:
- H2 Database: A relational database engine.
- RDF4J: A framework for processing semantic data.
- SystemDS: An Apache machine learning system.
- Dubbo: A high-performance RPC framework.
The final dataset comprised 922 test files and over 4,200 individual test runs. To maintain hardware consistency—a critical factor in performance measurement—all data was collected from Ubuntu 18.04 virtual machines on GitHub-hosted runners.
Key Results and Insights
The evaluation of TEP-GNN revealed several critical insights into the nature of test execution and the efficacy of GNNs in this domain:
- Functional Tests are Predictable: The study demonstrates that functional tests are more "learnable" than general business logic. This is largely because tests often consist of predictable boilerplate setups and specific API calls that provide strong signals to the neural network.
- The Importance of Flow: The results reinforce that syntax alone is insufficient for performance prediction. Explicitly modeling how data flows through variables is essential for the GNN to estimate the computational work being performed.
- Performance Metrics: TEP-GNN achieved a Pearson correlation of 0.789 between predicted and actual execution times, significantly outperforming the GGNN baseline (0.697). The model also maintained a low Mean Squared Error (MSE) of 0.017, indicating high consistency in its predictions.
Limitations and Future Directions
The primary challenge identified is cross-project generalization. While TEP-GNN is highly accurate when predicting runtimes for tests within a known project, its performance drops when applied to entirely "unseen" codebases. This is attributed to the model's reliance on project-specific APIs; if the model has not encountered a specific library or API during training, it cannot accurately estimate the "weight" of calls to that library.
Future work will focus on:
- Meta-Learning: Implementing techniques to help the model adapt quickly to the vocabulary of new codebases.
- Richer Graph Representations: Incorporating Program Dependency Graphs (PDGs) to provide deeper semantic insights.
- Generalization: Extending the approach to predict the performance of arbitrary software components beyond the scope of functional tests.
Summary updated