pjfanning opened a new pull request, #1309:
URL: https://github.com/apache/poi/pull/1309

   ## Summary
   
   New `poi-benchmark` Gradle module using 
[me.champeau.jmh](https://github.com/melix/jmh-gradle-plugin) (0.7.3, JMH 
1.37). It depends on `poi` and `poi-scratchpad` only — the OOXML modules will 
get a separate benchmark module because their build is slow.
   
   **Build wiring**
   - `settings.gradle`: module added; root `build.gradle`: plugin declared with 
`apply false`, `poi-benchmark` added to the module-info verification skip list 
next to `poi-fuzz`.
   - Javadoc, sources jar and publishing disabled (as `poi-fuzz`); not in the 
RAT/source-distribution include list (also as `poi-fuzz`).
   - `jmhJar` writes to the module's `build/libs` because the root `Jar` 
convention deletes any jar not named `*-<version>.jar` from the dist dir.
   - Run: `./gradlew :poi-benchmark:jmh` (results in `build/reports/jmh/`), or 
`java -jar poi-benchmark/build/libs/poi-benchmark-<version>-jmh.jar [-prof 
gc]`. `-Pjmh.includes=<regex>` selects benchmarks.
   
   **Fixture** — `InvoiceWorkbookBuilder` (`src/main`, format-agnostic 
`Workbook` so the OOXML benchmarks can reuse it). Seeded random order data, N 
rows, eight formulas per row — `A*C*(1-D)`, `ROUND(E*TaxRate,2)` (defined 
name), `E+F`, `IF(G>Params!$B$2,…)`, cross-sheet `VLOOKUP`, `C-I`, a 
running-total chain `K(n-1)+G`, `IF(J<>0,…)` — plus a summary block (`SUM`×4, 
`COUNTIF`×2, `AVERAGE`/`MAX`/`MIN`, one `SUMIF` per item, a grand total over 
those). `TestInvoiceWorkbookBuilder` checks every formula evaluates without 
error, the running total equals the column total and the `SUMIF`s partition it.
   
   **Benchmark** — `HSSFFormulaEvaluationBenchmark`: one full pass with a 
*fresh* `HSSFFormulaEvaluator` per invocation (the recommended usage after 
workbook changes larger than individual cells), single-threaded, average time, 
3×2s warmup / 5×2s measurement, one fork. Params: `rows = 100, 200`, `stability 
= DEFAULT, TOTALLY_IMMUTABLE`. Runs in about 75s.
   
   ## First results (Java 17, Apple Silicon, `-prof gc`)
   
   | rows | formulas | stability | time/op | alloc/op | per formula |
   |---|---|---|---|---|---|
   | 100 | 815 | DEFAULT | 2.38 ms | 2.15 MB | 2.9 µs, 2.6 KB |
   | 100 | 815 | TOTALLY_IMMUTABLE | 1.73 ms | 1.52 MB | 2.1 µs, 1.9 KB |
   | 200 | 1615 | DEFAULT | 4.94 ms | 4.34 MB | 3.1 µs, 2.7 KB |
   | 200 | 1615 | TOTALLY_IMMUTABLE | 3.59 ms | 3.09 MB | 2.2 µs, 1.9 KB |
   
   - Dependency tracking (`DEFAULT` vs `TOTALLY_IMMUTABLE`) costs ~27% of the 
time and ~30% of the allocation.
   - Scaling from 100 to 200 rows is linear (2.07× time, 2.02× allocation for 
1.98× formulas).
   - ~1.9 KB is allocated per formula evaluation even with tracking off.
   
   Evaluating the cells without writing the results back 
(`FormulaEvaluator.evaluate(Cell)` into a `Blackhole`) measured the same within 
noise, so there is no separate benchmark for it.
   
   ## Test plan
   
   - [x] `./gradlew :poi-benchmark:check` (includes 
`TestInvoiceWorkbookBuilder`)
   - [x] `./gradlew :poi-benchmark:jmhJar` and a full benchmark run
   - [ ] CI
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to