Repository navigation
Performance Tracker for Annotation Processing #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
008da5f
Adding a module for holding testclasses for performance test
AndreasIgel 8f7321c
Moving ProcessingLogger into package org.javahelpers.simple.builders.…
AndreasIgel 1bf5e03
Implementation of first PerformanceTracking algorithm
AndreasIgel 0dcec37
Refactoring of performance tracker and integration in build process
AndreasIgel 9578186
Adding a python script for class creation
AndreasIgel ae10229
Adding a first draft of a json file for class generation
AndreasIgel 0dfc498
Removing unneeded properties form generation json
AndreasIgel c0d6163
Adepting class names so that it is not offensive
AndreasIgel 808cf0b
Improving json-structure and generation-python to generate enums and …
AndreasIgel d286a2f
Adding code for exporting analysis data to json
AndreasIgel cea5611
Hardening the ActivePerformanceTracker
AndreasIgel dfa067d
Adding run-profiles for all potential builder-types, adapting script …
AndreasIgel ab1278a
improving PerformanceTracker and adding test for it
AndreasIgel 424c355
Improving gitignore to not have files from performance-test in git
AndreasIgel a6941be
Refactoring analysis for better understanding
AndreasIgel 904bfe6
Adding script for comparing performance
AndreasIgel 21a65d2
Adding section to README.md
AndreasIgel 9381d37
Optimization of class generation, updating documentation and definiti…
AndreasIgel b57225c
Improving analysis and fixing warnings in generation
AndreasIgel afdebcc
optimize performance-measurement to count generations for lombok corr…
AndreasIgel ce70e11
Fixing sonarqube findings on PR
AndreasIgel c2e2fdc
Removing unused parameteres
AndreasIgel 44d18f9
Replace manual StringBuilder JSON with Map-based serializer in Active…
AndreasIgel a24f8ab
Simplify PERFORMANCE_ANALYSIS.md per review feedback
AndreasIgel 9b5d8a6
Improve ActivePerformanceTracker class javadoc
AndreasIgel 9fdf357
Make ActivePerformanceTracker thread-safe
AndreasIgel 5efebf8
Replace string prefix collection detection with instanceof checks
AndreasIgel de78e70
Remove getLogger() from ProcessingContext
AndreasIgel 2215ad0
Adding trailing new line to end of file
AndreasIgel 31d6d36
Add run_full_comparison.py master script for performance analysis
AndreasIgel 338db79
Removing unneeded complexity in compare_performance script
AndreasIgel 07a5e04
Fixing sonarqube findings and reduction of complexity in json print out
AndreasIgel b4acce4
Removing tests with low value
AndreasIgel b6ac26d
Address PR review comments: remove verbose from pom.xml, rename has_j…
AndreasIgel e2dc9a8
Replace bare shutil.rmtree with safe_rmtree that validates path is wi…
AndreasIgel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # Performance Analysis Guide | ||
|
|
||
| This guide explains how to run performance analysis for different builder | ||
| frameworks using the scripts in the `performance-test` module. | ||
|
|
||
| ## Overview | ||
|
|
||
| The performance test module generates a large set of Java classes (records and | ||
| plain classes) from a JSON catalog, then compiles them with a builder annotation | ||
| processor to measure processing time. Three scripts work together: | ||
|
|
||
| | Script | Purpose | | ||
| |---|---| | ||
| | `generate_classes.py` | Generate Java source files with a chosen builder annotation | | ||
| | `run_performance_measurement.py` | Run N compilations and aggregate timing results | | ||
| | `compare_performance.py` | Compare results from multiple measurement runs side-by-side | | ||
| | `run_full_comparison.py` | Run all frameworks end-to-end and compare (convenience) | | ||
|
|
||
| ## Supported Builder Types | ||
|
|
||
| | `--builder-type` | Annotation | Maven Profile | JSON Report | Notes | | ||
| |---|---|---|---|---| | ||
| | `simple-builder` | `@SimpleBuilder` | `simplebuilder` | Yes | Full feature set (default) | | ||
| | `simple-minimal-builder` | `@MinimalBuilder` | `minimalbuilder` | Yes | All optional features disabled | | ||
| | `record-builder` | `@RecordBuilder` | `recordbuilder` | No | RecordBuilder library (wall-time only) | | ||
| | `lombok` | `@Builder` | `lombok` | No | Lombok (wall-time only) | | ||
|
|
||
| Builder types with JSON reports produce detailed phase/class/generator/enhancer | ||
| metrics. Builder types without JSON reports only measure overall wall time. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| Run all four frameworks with N runs each, then compare: | ||
|
|
||
| ```bash | ||
| python3 scripts/run_full_comparison.py --runs 10 | ||
| ``` | ||
|
|
||
| Use `--keep-builders` to copy generated builders to `generated-builders/<type>/` | ||
| so they survive Maven clean: | ||
|
|
||
| ```bash | ||
| python3 scripts/run_full_comparison.py --runs 30 --keep-builders | ||
| ``` | ||
|
|
||
| Labels are auto-generated as `sb-<N>runs`, `mb-<N>runs`, `rb-<N>runs`, | ||
| `lombok-<N>runs`. | ||
|
|
||
| ### Running Individual Frameworks | ||
|
|
||
| For single-framework measurements, use the individual scripts directly. | ||
| Use `--force` when regenerating classes after switching builder types. | ||
|
|
||
| ```bash | ||
| python3 scripts/generate_classes.py --builder-type simple-builder --force | ||
| python3 scripts/run_performance_measurement.py --runs 30 --label sb-30runs --builder-type simple-builder | ||
| ``` | ||
|
|
||
| Results are written to `performance-test/performance-reports/<label>/`. Compare paths | ||
| are relative to that directory (or use absolute paths). The parent directory | ||
| name is used as the column label. | ||
|
|
||
| When comparing JSON-profile runs with wall-time-only runs, the script | ||
| automatically shows wall time for all summaries and detailed metrics | ||
| (processor time, phases, classes, generators, enhancers) only when | ||
| available. | ||
|
|
||
| ## Output File Locations | ||
|
|
||
| ``` | ||
| performance-test/ | ||
| └── performance-reports/ | ||
| ├── sb-30runs/ | ||
| │ ├── run-01.json | ||
| │ ├── run-02.json | ||
| │ ├── ... | ||
| │ └── summary.json | ||
| ├── mb-30runs/ | ||
| │ ├── run-01.json | ||
| │ ├── ... | ||
| │ └── summary.json | ||
| ├── rb-30runs/ | ||
| │ └── summary.json (wall-time only) | ||
| └── lombok-30runs/ | ||
| └── summary.json (wall-time only) | ||
| ``` | ||
|
|
||
| ## Summary JSON Structure | ||
|
|
||
| ### JSON-Profile Summaries (simple-builder, simple-minimal-builder) | ||
|
|
||
| ```json | ||
| { | ||
| "runCount": 30, | ||
| "wallTime": { "min": ..., "max": ..., "avg": ..., "values": [...] }, | ||
| "sourceFileCount": 1077, | ||
| "generatedBuilderCount": 1077, | ||
| "compilerTime": { "min": ..., "max": ..., "avg": ..., "values": [...] }, | ||
| "compilerTimePerBuilderMs": { "min": ..., "max": ..., "avg": ... }, | ||
| "processorTime": { "min": ..., "max": ..., "avg": ..., "values": [...] }, | ||
| "averagePerClassMs": { "min": ..., "max": ..., "avg": ..., "values": [...] }, | ||
| "totalClasses": 1077, | ||
| "phaseAverageNanos": { "Phase.Name": avgNanos, ... }, | ||
| "topClassesByAvg": [ | ||
| { "className": ..., "avgMs": ..., "minMs": ..., "maxMs": ..., | ||
| "fieldCount": ..., "collectionCount": ... } | ||
| ], | ||
| "generatorStats": [ | ||
| { "name": ..., "avgElapsedNanos": ..., "avgCalls": ..., "avgMsPerCall": ... } | ||
| ], | ||
| "enhancerStats": [ | ||
| { "name": ..., "avgElapsedNanos": ..., "avgCalls": ..., "avgMsPerCall": ... } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ### Wall-Time-Only Summaries (record-builder, lombok) | ||
|
|
||
| ```json | ||
| { | ||
| "runCount": 30, | ||
| "wallTime": { "min": ..., "max": ..., "avg": ..., "values": [...] }, | ||
| "sourceFileCount": 1077, | ||
| "generatedBuilderCount": 1077, | ||
| "compilerTime": { "min": ..., "max": ..., "avg": ..., "values": [...] }, | ||
| "compilerTimePerBuilderMs": { "min": ..., "max": ..., "avg": ... }, | ||
| "wallTimeOnly": true | ||
| } | ||
| ``` | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.