Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
58d56c9
feat: add benchmark module for FastExcel performance analysis
GOODBOY008 Jan 16, 2026
5529b76
feat(benchmark): add comprehensive Fesod benchmark module and enhance…
GOODBOY008 Jun 27, 2026
28afc74
refactor(benchmark): remove unused dependencies and simplify result c…
GOODBOY008 Jun 28, 2026
46e41cc
Merge branch 'main' into feat/benchmark-comparison-workflow
alaahong Aug 7, 2026
4eec1c7
feat(benchmark): redesign benchmark module as performance baseline re…
GOODBOY008 Aug 28, 2026
1c90f17
fix(benchmark): run baseline suite from module dir so result paths re…
GOODBOY008 Aug 28, 2026
44cd72e
Merge 1c90f1730c3d0ac392ef8bf5d0d1f256c057235c into fd575418dfb9564e0…
GOODBOY008 Aug 28, 2026
4eb7745
chore(benchmark): refresh performance baseline from 44cd72ef87fd03d3a…
github-actions[bot] Aug 28, 2026
701d850
feat(benchmark): move gate to release tags + manual dispatch with tie…
GOODBOY008 Aug 28, 2026
08d38b5
chore(benchmark): refresh performance baseline from 701d850a7d2964345…
github-actions[bot] Aug 28, 2026
06282a6
fix(benchmark): regression notification is best-effort when issues ar…
GOODBOY008 Aug 28, 2026
1c11968
fix(benchmark): post release regression comments via REST API
GOODBOY008 Aug 28, 2026
3a08cf4
fix(benchmark): guard release id lookup against error body leakage
GOODBOY008 Aug 28, 2026
56f393e
fix(benchmark): make regression notification a best-effort ladder
GOODBOY008 Aug 28, 2026
4d078ac
feat(benchmark): track LARGE (100K rows) and surface absolute alloc p…
GOODBOY008 Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions fesod-benchmark/benchmark.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Fesod Benchmark Guide

This guide provides a comprehensive overview of the Fesod benchmark module, including how to run benchmarks, interpret the results, and contribute new benchmarks.

## Overview

The benchmark module measures and analyzes the performance of Fesod 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.

Key goals:

- Provide a standardized way to measure the performance of Fesod.
- Track performance regressions and improvements over time.
- Compare the performance of Fesod with other Excel libraries, such as Apache POI.
- Help users make informed decisions about how to use Fesod for their specific needs.

> **Note:** Benchmark code in this module is not part of the Fesod public API.

## How to Run Benchmarks

### Using the Shade JAR (Recommended)

Build the uber-jar and run benchmarks directly:

```bash
mvn clean package -f fesod-benchmark/pom.xml -DskipTests
java -jar fesod-benchmark/target/benchmarks.jar
```

Run a specific benchmark class:

```bash
java -jar fesod-benchmark/target/benchmarks.jar ReadBenchmark
```

Run with JMH GC profiler for memory analysis:

```bash
java -jar fesod-benchmark/target/benchmarks.jar -prof gc
```

Export results as JSON:

```bash
java -jar fesod-benchmark/target/benchmarks.jar -rf json -rff results.json
```

### Using the Comparison Runner

The `ComparisonBenchmarkRunner` provides a pre-configured Fesod vs Apache POI comparison:

```bash
java -cp fesod-benchmark/target/benchmarks.jar \
org.apache.fesod.sheet.benchmark.comparison.ComparisonBenchmarkRunner
```

Results are written to `target/benchmark-results/<session-id>/`.

### Using Maven Profiles

```bash
# Run all benchmarks via Maven
mvn verify -f fesod-benchmark/pom.xml -P benchmark -Dbenchmark.pattern=.*

# Run a specific benchmark
mvn verify -f fesod-benchmark/pom.xml -P benchmark -Dbenchmark.pattern=ReadBenchmark

# Quick CI smoke test (1 fork, 1 iteration, 0 warmup)
mvn verify -f fesod-benchmark/pom.xml -P benchmark-test
```

## Benchmark Suites

The benchmark module includes the following suites:

| Suite | Description |
|---|---|
| **Comparison** | Head-to-head comparison of Fesod vs Apache POI for read, write, and streaming operations |
| **Operations** | Focused benchmarks for read (`ReadBenchmark`), write (`WriteBenchmark`), and fill (`FillBenchmark`) operations |

### Dataset Sizes

| Size | Rows | Use Case |
|---|---|---|
| `SMALL` | 1,000 | Quick development feedback |
| `MEDIUM` | 10,000 | Standard CI benchmarks |
| `LARGE` | 100,000 | Performance analysis |
| `EXTRA_LARGE` | 1,000,000 | Stress testing (comparison benchmarks only) |

## JMH Best Practices Applied

This benchmark module follows JMH best practices:

1. **No manual timing** - JMH handles all timing measurements via `@BenchmarkMode`.
2. **No `System.gc()` calls** - Avoids unpredictable pauses that distort measurements.
3. **Fixed heap size** - `-Xms` equals `-Xmx` for stable GC behavior.
4. **Pre-loaded data** - All test data is generated in `@Setup(Level.Trial)` to exclude I/O from measurements.
5. **Fixed random seed** - Ensures reproducible data generation across runs.
6. **Fair comparison** - Both Fesod and Apache POI write/read the same columns.
7. **`Blackhole.consume()`** - Prevents dead code elimination by the JIT compiler.
8. **`@OperationsPerInvocation`** - Allows JMH to correctly calculate throughput.

## Interpreting Results

JMH produces output in the following format:

```
Benchmark (datasetSize) (fileFormat) Mode Cnt Score Error Units
FastExcelVsPoiBenchmark.benchmarkFesodRead SMALL XLSX avgt 5 2.345 ± 0.123 ms/op
FastExcelVsPoiBenchmark.benchmarkPoiRead SMALL XLSX avgt 5 5.678 ± 0.456 ms/op
```

Key columns:
- **Mode**: `avgt` (average time), `thrpt` (throughput), `ss` (single shot)
- **Score**: The benchmark score (lower is better for `avgt`, higher for `thrpt`)
- **Error**: 99% confidence interval
- **Units**: `ms/op` (milliseconds per operation), `ops/s` (operations per second)
229 changes: 229 additions & 0 deletions fesod-benchmark/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.fesod</groupId>
<artifactId>fesod-parent</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>fesod-benchmark</artifactId>
<name>fesod-benchmark</name>
<description>Comprehensive benchmark module for Fesod performance analysis</description>

<properties>
<jmh.version>1.37</jmh.version>
<uberjar.name>benchmarks</uberjar.name>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.fesod</groupId>
<artifactId>fesod-sheet</artifactId>
<version>${project.version}</version>
</dependency>

<!-- JMH Dependencies -->
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>

<!-- Apache POI for comparison benchmarks -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</dependency>

<!-- Utilities -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>

<!-- JSON handling for reports -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${uberjar.name}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<!--
Shading signed JARs will fail without this.
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<!-- Full benchmark run: mvn verify -Pbenchmark -Dbenchmark.pattern=.*FastExcel.* -->
<profile>
<id>benchmark</id>
<properties>
<benchmark.pattern>.*</benchmark.pattern>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>run-benchmarks</id>
<phase>integration-test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.openjdk.jmh.Main</mainClass>
<arguments>
<argument>${benchmark.pattern}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Quick smoke test profile for CI: minimal iterations, no warmup -->
<!-- Usage: mvn verify -Pbenchmark-test -->
<profile>
<id>benchmark-test</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>run-benchmark-smoke-test</id>
<phase>integration-test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.openjdk.jmh.Main</mainClass>
<arguments>
<argument>-f</argument>
<argument>1</argument>
<argument>-i</argument>
<argument>1</argument>
<argument>-wi</argument>
<argument>0</argument>
<argument>-p</argument>
<argument>datasetSize=SMALL</argument>
<argument>-p</argument>
<argument>fileFormat=XLSX</argument>
<argument>.*</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading
Loading