---
name: performance
description: Measure JasperReports compile, fill, export, heap, and temporary-resource behavior before tuning. Use for measurable report workload optimization, not unrelated application performance or layout-only edits.
---
# Measure JasperReports performance
## Define a reproducible workload
Record the JasperReports Library and extension versions, Java version, heap settings, machine and storage characteristics, concurrency, dataset size and shape, output format, and report features. Keep the data synthetic. Separate compile, fill, export, and any database or service latency; a slow query is not a JasperReports fill bottleneck. Use the same input, output requirements, environment, and JVM limits for the baseline and every candidate.
Warm up the same code path, run multiple measurements, and report medians or distributions rather than a single best time. Measure wall-clock compile/fill/export duration separately, and measure heap using a stated method such as a profiler or sampled heap readings. Record GC and temporary-disk activity when they are relevant. Do not infer peak heap from `JasperPrint` size or a benchmark with a different dataset. Keep benchmark instrumentation outside the measured interval where possible.
Validate output equivalence independently: compare page counts, expected text and totals, export cell values or other format-specific semantics before accepting a speed or memory trade-off. Do not introduce timing thresholds into ordinary unit tests unless the environment is controlled and the threshold is stable.
## Optimize the measured bottleneck
Change one factor at a time. Consider report compilation and application-owned compiled-report caching, data-source/query cost, expression and element volume, pagination and layout, exporter configuration, output buffering, and request concurrency. For database work, profile query plans and connection behavior separately; see [data-sources](../data-sources/SKILL.md). For application cache and per-request lifecycle, see [java-integration](../java-integration/SKILL.md).
Treat virtualizers as a memory-versus-CPU-and-disk trade-off, not an automatic speed optimization. Compare the same report with and without a virtualizer under a fixed heap, include serialization and export costs, and ensure the workload is large enough to expose memory pressure. Check available disk space and permissions, use a request/job-scoped virtualizer and temporary directory, and call `cleanup()` in a `finally` path after export, including failures. Do not share virtualizers across concurrent fills or keep partial output after an export failure.
Use report governors and application-level limits to bound work when inputs can grow, but distinguish a protective limit from a performance optimization. Make a limit failure visible; do not silently truncate or return an incomplete report as success. Monitor latency, throughput, heap/GC, and temporary storage under realistic concurrency after tuning.
## Verify and report
Run the same fixed workload against a recorded baseline and the candidate. Verify resource cleanup on both successful and failing exports, check that output semantics remain correct, and report the measurements even when a candidate is slower or uses more memory. Revert or reject regressions instead of presenting a configuration as an improvement because it is theoretically faster.
The repository's JasperReports 7.1.1 fixture compares a fixed synthetic report under a fixed `-Xms128m -Xmx512m` heap, checks identical page counts and extracted PDF text, and verifies swap-virtualizer cleanup on success and export failure. Its heap value is sampled, single-run test evidence and can vary by machine; it is not a general benchmark result or a substitute for repeated production-like measurements.
## Deliver
Report the exact engine, extensions, Java, heap, workload and output versions; baseline and candidate methodology; compile/fill/export timings and memory measurement; GC and temporary-storage trade-offs; output-equivalence checks; cleanup behavior; exact commands and results; and untested workload assumptions.
## Sources
- [JasperReports API](https://jasperreports.sourceforge.net/api/index.html)
- [JRSwapFileVirtualizer API](https://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/fill/JRSwapFileVirtualizer.html)
- [Java integration](../java-integration/SKILL.md)
- [Data sources](../data-sources/SKILL.md)
- [Compile and test](../compile-test/SKILL.md)
<!-- ‹guest · 2026-11-29› -->
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.