Skip to content

Performance Benchmarking Guide with JMH

Samuel Abramov edited this page Nov 20, 2023 · 1 revision

To benchmark our performance-critical code, we use JMH (Java Microbenchmark Harness). Follow these steps to set up and execute the benchmarks:

Step 1: Download and Prepare the Benchmark Dataset

  • Download the Dataset: Download a benchmark dataset from the provided link. Benchmark Dataset
  • Extract the Dataset: After downloading, extract the dataset into the directory edux/benchmark-data/.
    • Important: Do not rename the folder after extraction.

Step 2: Run JMH Benchmarks

A complete run can take more than 30 min.

  • Execute Benchmarks Using Gradle:
    • Use the Gradle command to run the JMH benchmarks. This can typically be done with a command like ./gradlew jmh in your terminal or command prompt, depending on your project's Gradle setup.

Step 3: Analyze the Results

  • JSON Results File:
    • After the benchmarks have been run, a JSON file with the results will be created.
    • This file can typically be found in the edux\lib\benchmark-results.json directory, or the directory specified in your JMH configuration.

Step 4: Visualizing Benchmark Results

  • Use a Visualization Tool:
    • You can use tools like JMH Visualizer to upload and visually analyze the JSON results file.
    • This helps in better understanding the performance metrics and identifying any bottlenecks or areas for improvement.

By following these steps, you can effectively benchmark and analyze the performance of your critical code segments using JMH.

EDUX Implementation Details

Clone this wiki locally