Skip to Main content Skip to Navigation
New interface
Conference papers

Automatic Microbenchmark Generation to Prevent Dead Code Elimination and Constant Folding

Marcelino Rodriguez-Cancio 1 Benoit Combemale 1 Benoit Baudry 1 
1 DiverSe - Diversity-centric Software Engineering
Inria Rennes – Bretagne Atlantique , IRISA-D4 - LANGAGE ET GÉNIE LOGICIEL
Abstract : Microbenchmarking consists of evaluating, in isolation, the performance of small code segments that play a critical role in large applications. The accuracy of a microbenchmark depends on two critical tasks: wrap the code segment into a payload that faithfully recreates the execution conditions that occur in the large application; build a scaffold that runs the payload a large number of times to get a statistical estimate of the execution time. While recent frameworks such as the Java Microbenchmark Harness (JMH) take care of the scaffold challenge, developers have very limited support to build a correct payload. In this work, we focus on the automatic generation of pay-loads, starting from a code segment selected in a large application. In particular, we aim at preventing two of the most common mistakes made in microbenchmarks: dead code elimination and constant folding. Since a microbench-mark is such a small program, if not designed carefully, it will be " over-optimized " by the JIT and result in distorted time measures. Our technique hence automatically extracts the segment into a compilable payload and generates additional code to prevent the risks of " over-optimization ". The whole approach is embedded in a tool called AutoJMH, which generates payloads for JMH scaffolds. We validate the capabilities AutoJMH, showing that the tool is able to process a large percentage of segments in real programs. We also show that AutoJMH can match the quality of payloads handwritten by performance experts and outperform those written by professional Java developers without experience un microbenchmarking.
Complete list of metadata

Cited literature [35 references]  Display  Hide  Download
Contributor : Marcelino Rodriguez-Cancio Connect in order to contact the contributor
Submitted on : Sunday, July 10, 2016 - 11:18:51 AM
Last modification on : Saturday, June 25, 2022 - 7:42:10 PM


Files produced by the author(s)


Distributed under a Creative Commons Attribution 4.0 International License


  • HAL Id : hal-01343818, version 1


Marcelino Rodriguez-Cancio, Benoit Combemale, Benoit Baudry. Automatic Microbenchmark Generation to Prevent Dead Code Elimination and Constant Folding. 31st IEEE/ACM International Conference on Automated Software Engineering (ASE 2016) , Sep 2016, Singapore, Singapore. ⟨hal-01343818⟩



Record views


Files downloads