Among different things, software craftsmanship is about tools, and tools for measuring the performance of software are definitely something that should be present on every software craftsman's belt. In this session, we will introduce you to JMH, an OpenJDK harness for building, running and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM. It should help you find spots to optimise performance and, which may be even more important, it will show you parts that you don't really need to optimise. It not only will make your benchmarks more accurate, but also much easier to write.
We will detail why benchmarking is hard, discuss JVM internals to bring the audience to the same page explaining, at a high level, how the JIT compiler works and how code is executed by the JVM. We will then present JMH and explain how it can be used to confidently warmup the JVM, avoid compiler optimisations on the benchmark code, and make sure that you're measuring right. We will explain how multi-threaded benchmarks can become a piece of cake to write and how you can even profile your code out-of-the-box using JMH. Finally, we will talk about how it can be part of your continuous integration process and discuss our experience using JMH to benchmark critical pieces of the Amadeus distributed systems.
JMH is for benchmarking what JUnit is for unit-testing. The talk will be filled with live coding and short examples that will help to demonstrate and understand the concepts.
Agenda