Overview
Thediff command compares two profiling files and categorizes changes as:
- REGRESSION: Methods that increased in self time
- IMPROVEMENT: Methods that decreased in self time
- NEW: Methods present only in the second profile
- GONE: Methods present only in the first profile
Usage
Flags
Event type to analyze:
cpu, wall, alloc, lock, or hardware counter nameFilter to threads matching this substring
Hide entries with changes smaller than this percentage
Limit output rows per category (0 = unlimited)
Show fully-qualified names (includes package path)
Time Window Flags (JFR only)
These flags enable comparing two time windows within a single JFR file:Start of first time window (e.g., ”55s”, “1m05s”)
End of first time window
Start of second time window
End of second time window
For single-file window diffs, you must specify at least one flag from
--from/--to and at least one from --vs-from/--vs-to.Examples
Compare Two Profile Files
Filter Small Changes
Show only changes greater than 5%:Compare Time Windows
Compare early vs late period within the same recording:Compare Specific Event Types
Limit Output
Show only top 10 entries per category:Thread-Specific Diff
Compare only worker threads:Output Format
Each category shows:- Method name (short name by default, FQN with
--fqn) - Before percentage
- After percentage
- Delta (change)
--min-delta, outputs:
Use Cases
Performance Regression Detection
Integrate into CI to catch performance regressions:Before/After Code Changes
Measure impact of an optimization:Startup vs Steady-State
Compare different phases of execution:Supported Input Formats
- JFR (Java Flight Recorder): Supports all features including time windows
- pprof: Two-file comparison only (no time windows)
- Collapsed stacks: Two-file comparison only
- Mixed: Can compare different formats (e.g., JFR vs pprof)