Tuesday, April 27, 2021

Java Microbenchmark Harness (JMH)

Introduction

In my previous article, we established that microbenchmarking is hard with jvm. It is not enough to surround the code in a loop with System.out.println() and gather the time measurements. While benchmarking, a developer should consider warm-up cycles, JIT compilations, JVM optimizations, avoiding usual pitfalls, and even more.

Thankfully, OpenJDK has a great tool Java Microbenchmark Harness (JMH) that can help us generated benchmarking stats. In this article, we will discuss how JMH can help us avoid the pitfalls that we have discussed earlier.



from DZone.com Feed https://ift.tt/3nsUWo3

No comments:

Post a Comment