




















Abstract:Developers often use microbenchmarks to choose the most performant implementation of a method or a class. On the Java Virtual Machine (JVM), this is commonly done using the Java Microbenchmark Harness (JMH) which addresses common pitfalls of measuring code performance on the JVM. However, even using JMH guidelines cannot overcome the fundamental issue of context.
Microbenchmarks inherently execute code in isolation, without interference from other application code competing for CPU resources, such as cache or branch-predictor capacity. On managed runtimes with tiered dynamic compilation, such as the JVM, the speculative, profile-driven nature of compilation decisions means that code performance is highly dependent on profiles collected during early execution. Because profiles usually include also branch probabilities and receiver types (besides code hotness metrics), a badly designed microbenchmark may cause the JVM to collect an unrealistic profile, resulting in aggressive, yet misleading, optimizations, that would not occur in a real application.
In this paper, we demonstrate how using microbenchmarks under conditions that induce the JVM to collect unrealistic profiles yields misleading results despite following existing guidelines. We also extend these guidelines by suggesting actions to make the microbenchmark results more representative.
| Subjects: | Programming Languages (cs.PL); Software Engineering (cs.SE) |
| Cite as: | arXiv:2605.23570 [cs.PL] |
| (or arXiv:2605.23570v1 [cs.PL] for this version) | |
| https://doi.org/10.48550/arXiv.2605.23570 arXiv-issued DOI via DataCite (pending registration) |
|
| Journal reference: | The 41st ACM/SIGAPP Symposium on Applied Computing (SAC '26), March 23--27, 2026, Thessaloniki, Greece |
| Related DOI: | https://doi.org/10.1145/3748522.3779882
DOI(s) linking to related resources |
From: Filippo Schiavio [view email]
[v1]
Fri, 22 May 2026 12:38:12 UTC (198 KB)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。