Skip to Content
Java EE 8 High Performance
book

Java EE 8 High Performance

by Romain Manni-Bucau
January 2018
Intermediate to advanced
350 pages
9h 7m
English
Packt Publishing
Content preview from Java EE 8 High Performance

Writing a benchmark with JMH

Before being able to write code with JMH, you need to add it as a dependency of your project. We will use Maven syntax in the following example, but it has equivalents for Gradle, and so on.

The first thing to do is to add into your pom.xml the following dependencies; we will use the scope test since the dependencies are only needed for our performance tests and not the "main" code:

<dependencies>  <!-- your other dependencies -->  <dependency>    <groupId>org.openjdk.jmh</groupId>    <artifactId>jmh-core</artifactId>    <version>${jmh.version}</version>    <scope>test</scope>  </dependency>  <dependency>    <groupId>org.openjdk.jmh</groupId>    <artifactId>jmh-generator-annprocess</artifactId>    <version>${jmh.version}</version>    <
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java EE 8 Application Development

Java EE 8 Application Development

David R. Heffelfinger
Java 9 High Performance

Java 9 High Performance

Mayur Ramgir, Nick Samoylov
Java EE 8 Design Patterns and Best Practices

Java EE 8 Design Patterns and Best Practices

Rhuan Rocha, Joao Carlos Purificação

Publisher Resources

ISBN: 9781788473064Supplemental Content