|
| 1 | +# FastExcel Benchmark Guide |
| 2 | + |
| 3 | +This guide provides a comprehensive overview of the FastExcel benchmark module, including how to run benchmarks, interpret the results, and contribute new benchmarks. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The benchmark module is designed to measure and analyze the performance of FastExcel for various Excel operations, such as reading, writing, and filling data. It uses the [Java Microbenchmark Harness (JMH)](https://openjdk.java.net/projects/code-tools/jmh/) to ensure accurate and reliable benchmark results. |
| 8 | + |
| 9 | +The key goals of the benchmark module are: |
| 10 | + |
| 11 | +- To provide a standardized way to measure the performance of FastExcel. |
| 12 | +- To track performance regressions and improvements over time. |
| 13 | +- To compare the performance of FastExcel with other Excel libraries, such as Apache POI. |
| 14 | +- To help users make informed decisions about how to use FastExcel for their specific needs. |
| 15 | + |
| 16 | +## How to Run Benchmarks |
| 17 | + |
| 18 | +There are two primary ways to run the benchmarks: using the `benchmark-runner.sh` script or using Maven profiles. |
| 19 | + |
| 20 | +### Using the `benchmark-runner.sh` Script |
| 21 | + |
| 22 | +The `benchmark-runner.sh` script provides a convenient way to run the benchmarks with various options. |
| 23 | + |
| 24 | +**Usage:** |
| 25 | + |
| 26 | +```bash |
| 27 | +./fastexcel-benchmark/scripts/benchmark-runner.sh [OPTIONS] |
| 28 | +``` |
| 29 | + |
| 30 | +**Options:** |
| 31 | + |
| 32 | +| Option | Description | Default | |
| 33 | +|---|---|---| |
| 34 | +| `-p`, `--profile` | Benchmark profile (quick, standard, comprehensive) | `standard` | |
| 35 | +| `-o`, `--output` | Output directory for results | `benchmark-results` | |
| 36 | +| `-j`, `--java-version` | Java version to use | `11` | |
| 37 | +| `-m`, `--memory` | JVM heap size | `4g` | |
| 38 | +| `-t`, `--pattern` | Benchmark pattern to match | | |
| 39 | +| `-d`, `--dataset` | Dataset size (SMALL, MEDIUM, LARGE, EXTRA_LARGE, ALL) | `ALL` | |
| 40 | +| `-f`, `--format` | Output format (json, csv, text) | `json` | |
| 41 | +| `-r`, `--regression` | Enable regression analysis | | |
| 42 | +| `-v`, `--verbose` | Enable verbose output | | |
| 43 | +| `-h`, `--help` | Show this help message | | |
| 44 | + |
| 45 | +**Profiles:** |
| 46 | + |
| 47 | +- `quick`: Fast execution for development (2 warmup, 3 measurement, 1 fork). |
| 48 | +- `standard`: Balanced execution for CI (3 warmup, 5 measurement, 1 fork). |
| 49 | +- `comprehensive`: Thorough execution for nightly (5 warmup, 10 measurement, 2 forks). |
| 50 | + |
| 51 | +**Examples:** |
| 52 | + |
| 53 | +- Run standard benchmarks: |
| 54 | + ```bash |
| 55 | + ./fastexcel-benchmark/scripts/benchmark-runner.sh --profile standard |
| 56 | + ``` |
| 57 | +- Run quick benchmarks for read operations only: |
| 58 | + ```bash |
| 59 | + ./fastexcel-benchmark/scripts/benchmark-runner.sh --profile quick --pattern "ReadBenchmark" |
| 60 | + ``` |
| 61 | +- Run comprehensive benchmarks with regression analysis: |
| 62 | + ```bash |
| 63 | + ./fastexcel-benchmark/scripts/benchmark-runner.sh --profile comprehensive --regression |
| 64 | + ``` |
| 65 | + |
| 66 | +### Using Maven Profiles |
| 67 | + |
| 68 | +You can also run the benchmarks using Maven profiles. This is useful for integrating the benchmarks into a CI/CD pipeline. |
| 69 | + |
| 70 | +**Usage:** |
| 71 | + |
| 72 | +```bash |
| 73 | +mvn clean install -f fastexcel-benchmark/pom.xml -P <profile> -Dbenchmark.pattern=<pattern> |
| 74 | +``` |
| 75 | + |
| 76 | +**Profiles:** |
| 77 | + |
| 78 | +- `benchmark`: The primary profile for running benchmarks. |
| 79 | + |
| 80 | +**Examples:** |
| 81 | + |
| 82 | +- Run all benchmarks: |
| 83 | + ```bash |
| 84 | + mvn clean install -f fastexcel-benchmark/pom.xml -P benchmark |
| 85 | + ``` |
| 86 | +- Run a specific benchmark: |
| 87 | + ```bash |
| 88 | + mvn clean install -f fastexcel-benchmark/pom.xml -P benchmark -Dbenchmark.pattern=ReadBenchmark |
| 89 | + ``` |
| 90 | + |
| 91 | +## Benchmark Suites |
| 92 | + |
| 93 | +The benchmark module includes the following suites: |
| 94 | + |
| 95 | +- **Comparison:** Benchmarks comparing FastExcel with other libraries (e.g., Apache POI). |
| 96 | +- **Config:** Benchmarks related to configuration options. |
| 97 | +- **Core:** Core benchmark classes and utilities. |
| 98 | +- **Data:** Benchmarks related to data handling and processing. |
| 99 | +- **Memory:** Benchmarks focused on memory usage. |
| 100 | +- **Operations:** Benchmarks for specific operations like read, write, and fill. |
| 101 | +- **Streaming:** Benchmarks for streaming operations. |
| 102 | + |
| 103 | +## Interpreting Results |
| 104 | + |
| 105 | +The benchmarks produce output in the format specified by the `--format` option. The default format is JSON. |
| 106 | + |
| 107 | +The output includes the following information: |
| 108 | + |
| 109 | +- **Benchmark:** The name of the benchmark. |
| 110 | +- **Mode:** The benchmark mode (e.g., `thrpt` for throughput, `avgt` for average time). |
| 111 | +- **Threads:** The number of threads used. |
| 112 | +- **Forks:** The number of forks used. |
| 113 | +- **Warmup Iterations:** The number of warmup iterations. |
| 114 | +- **Measurement Iterations:** The number of measurement iterations. |
| 115 | +- **Score:** The benchmark score. |
| 116 | +- **Score Error:** The error of the benchmark score. |
| 117 | +- **Unit:** The unit of the benchmark score (e.g., `ops/s` for operations per second). |
0 commit comments