Uh oh!
There was an error while loading. Please reload this page.
Performance Tracker for Annotation Processing - #258
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
d09be4a to
0a33554CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…processor.processing.logging
t add processor/src/main/java/org/javahelpers/simple/builders/processor/classgen/roaster/RoasterCodeGenerator.java && GIT_EDITOR=true git rebase --continue t add processor/src/main/java/org/javahelpers/simple/builders/processor/classgen/roaster/RoasterCodeGenerator.java sdft status --short t status --short t status
…for generating classes and adding documentation
…on of builder generation in pom.xml
Replace LinkedHashMap with ConcurrentHashMap for aggregation maps, use AtomicInteger for class counter, and ThreadLocal for per-class state. All methods are now safe for concurrent use from multiple threads.
Convenience script that runs all four builder frameworks end-to-end: generates classes, runs N measurement runs per framework, optionally copies generated builders to a safe location (source files for annotation processors, compiled classes for Lombok), and compares all results. Update PERFORMANCE_ANALYSIS.md to feature it in a Quick Start section, replacing the verbose per-framework workflow.
…son to is_simple_builders, extract popElapsed helper
948a9a8 to
b6ac26dCompareUh oh!
There was an error while loading. Please reload this page.



Performance Tracker for Annotation Processing
Implements a hierarchical performance tracking system for the simple-builders annotation processor, enabling detailed phase-by-phase timing analysis via
-Asimplebuilder.performanceTracking=true. Prepares for the analysis in #93. Closes#271.Summary
PerformanceTrackerinterface with No-Op pattern for zero overhead when disabledActivePerformanceTrackerwith hierarchical phase reporting using tree connectors (├─, └─, │)PerformanceTrackerinterface-Dsimplebuilder.performanceOutputFile=<path>for automated analysisperformance-testMaven module with Python scripts for class generation, measurement, and cross-framework comparisonConcurrentHashMapandThreadLocalstacksChanges
New files
processor/.../processing/logging/PerformanceTracker.java— Interface with publicPHASE_*constantsprocessor/.../processing/logging/ActivePerformanceTracker.java— Full implementation with hierarchical report and JSON exportprocessor/.../processing/logging/NoOpPerformanceTracker.java— Zero-overhead no-op implementationprocessor/src/test/.../logging/ActivePerformanceTrackerTest.java— Unit tests (21 tests covering phases, generators, enhancers, class metrics, JSON output, ThreadLocal cleanup)performance-test/pom.xml— Maven module with profiles forsimplebuilder,minimalbuilder,recordbuilder,lombokperformance-test/scripts/generate_classes.py— Generates ~1088 test DTO classes fromlibrary-class-catalog.jsonperformance-test/scripts/run_performance_measurement.py— Runs N compilation rounds and aggregates resultsperformance-test/scripts/run_full_comparison.py— Master script: generates classes, runs measurements across all builder frameworks, and compares resultsperformance-test/scripts/compare_performance.py— Compares summary JSON files across builder frameworksperformance-test/docs/PERFORMANCE_ANALYSIS.md— Documentation for the performance analysis workflowperformance-test/docs/library-class-catalog.json— Class catalog for test DTO generationModified files
processor/.../BuilderProcessor.java— Phase tracking for Configuration Resolution, Builder Definition Extraction, DTO Mapping, Code Generationprocessor/.../classgen/roaster/RoasterCodeGenerator.java— Sub-phase tracking inside individual methodsprocessor/.../generators/registry/GeneratorRegistry.java— Per-generator and per-enhancer timing wrappersprocessor/.../processing/ProcessingContext.java—PerformanceTrackerintegration based on compiler argumentprocessor/.../processing/CompilerArgumentsEnum.java— NewPERFORMANCE_TRACKINGenum valueprocessor/.../processing/BuilderConfigurationReader.java— Updated import for movedProcessingLoggerprocessor/.../processing/logging/ProcessingLogger.java— Moved fromprocessingtoprocessing.loggingpackageprocessor/.../generators/integration/JacksonModuleGenerator.java— Updated import for movedProcessingLoggerprocessor/src/test/.../RoasterCodeGeneratorResilienceTest.java— Updated constructor call forNoOpPerformanceTrackerpom.xml—performance-testmodule added toperformance-testprofileREADME.md— Link to performance analysis documentationdocs/CONFIGURATION.md— Documentation for performance tracking compiler arguments.gitignore— Ignore generated performance-test sources and reportsPhase Hierarchy
Percentages are calculated relative to the parent phase. All phase names are defined as public
Stringconstants onPerformanceTrackerand referenced via static imports at call sites.Report Output
When enabled, the performance report is printed to the compiler log (Maven NOTE level) and includes:
Additionally, a JSON report can be written to a file via
-Dsimplebuilder.performanceOutputFile=<path>JSON Report
When
-Dsimplebuilder.performanceOutputFile=<path>is set, a JSON report is written containing:timestamp— ISO-8601 timestamp of the reporttotalClasses— number of classes processedtotalProcessingTimeNanos/totalProcessingTimeSeconds— total processing timeaveragePerClassMs— average processing time per classphaseBreakdown— hierarchical phase timings with elapsed nanos, seconds, and percentagesclassMetrics— per-class metrics (name, elapsed nanos/ms, field count, collection count), sorted by elapsed time descendinggeneratorStats— per-generator stats (name, elapsed nanos, call count, avg ms/call)enhancerStats— per-enhancer stats (name, elapsed nanos, call count, avg ms/call)Performance Test Scripts
Quick Start
Supported builder types:
simple-builder,simple-minimal-builder,record-builder,lombokDesign Decisions
NoOpPerformanceTrackeris used — all methods are empty, allowing JIT to eliminate calls entirely. No boolean check per invocation.ConcurrentHashMapfor shared timing data,ThreadLocalstacks for per-thread start timestamps. AllThreadLocalvalues are explicitly removed inendClass()to prevent memory leaks.Map/Liststructures with a recursivetoJsonStringhelper — no external JSON dependency required.PHASE_CHILDRENmap inActivePerformanceTrackerfor report display. Call sites use flat phase names; the tracker maps them to the hierarchy.public static final StringonPerformanceTrackerinterface, imported via static imports — no string literals at call sites.safe_rmtreevalidates paths are within the project directory before removing, preventing accidental deletion.Usage
Enable performance tracking via compiler argument: