What's Wrong With My Benchmark Results? Studying Bad Practices in JMH Benchmarks
Artikel i vetenskaplig tidskrift, 2021

Microbenchmarking frameworks, such as Java's Microbenchmark Harness (JMH), allow developers to write fine-grained performance test suites at the method or statement level. However, due to the complexities of the Java Virtual Machine, developers often struggle with writing expressive JMH benchmarks which accurately represent the performance of such methods or statements. In this paper, we empirically study bad practices of JMH benchmarks. We present a tool that leverages static analysis to identify 5 bad JMH practices. Our empirical study of 123 open source Java-based systems shows that each of these 5 bad practices are prevalent in open source software. Further, we conduct several experiments to quantify the impact of each bad practice in multiple case studies, and find that bad practices often significantly impact the benchmark results. To validate our experimental results, we constructed patches that fix the identified bad practices for six of the studied open source projects, of which five were merged into the main branch of the project. In this paper, we show that developers struggle with accurate Java microbenchmarking, and provide several recommendations to developers of microbenchmarking frameworks on how to improve future versions of their framework.

Performance testing

Benchmark testing

Java

Static analysis

microbenchmarking

Optimization

static analysis

bad practices

JMH

Författare

Diego Elias Damasceno Costa

Universität Heidelberg

Cor Paul Bezemer

Queen's University

Philipp Leitner

Chalmers, Data- och informationsteknik, Software Engineering

Artur Andrzejak

Universität Heidelberg

IEEE Transactions on Software Engineering

0098-5589 (ISSN) 19393520 (eISSN)

Vol. 47 7 1452-1467 8747433

Utvecklarfokuserad prestandaförbättring för programvaruingenjörer

Vetenskapsrådet (VR) (2018-04127), 2019-01-01 -- 2023-12-31.

Styrkeområden

Informations- och kommunikationsteknik

Ämneskategorier

Programvaruteknik

DOI

10.1109/TSE.2019.2925345

Mer information

Senast uppdaterat

2021-08-17