Performance Tracker for Annotation Processing - #258
Open
AndreasIgel wants to merge 5 commits into
Open
Conversation
…processor.processing.logging
…e renderClassSource with phase tracking
|
| * Extraction") | ||
| * @param className the simple name of the class being processed | ||
| */ | ||
| void startPhase(String phase, String className); |
| * Extraction") | ||
| * @param className the simple name of the class being processed | ||
| */ | ||
| void startPhase(String phase, String className); |
| * | ||
| * @param generatorName the simple class name of the method generator | ||
| */ | ||
| void startGenerator(String generatorName); |
| * | ||
| * @param enhancerName the simple class name of the builder enhancer | ||
| */ | ||
| void startEnhancer(String enhancerName); |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




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.Summary
PerformanceTrackerinterface with No-Op pattern for zero overhead when disabledActivePerformanceTrackerwith hierarchical phase reporting using tree connectors (├─, └─, │)PerformanceTrackerinterfaceperformance-testMaven module scaffold (not part of default build)Changes
New files
processor/.../processing/logging/PerformanceTracker.java— Interface with 14 publicPHASE_*constantsprocessor/.../processing/logging/ActivePerformanceTracker.java— Full implementation with hierarchical reportprocessor/.../processing/logging/NoOpPerformanceTracker.java— Zero-overhead no-op implementationperformance-test/pom.xml— Maven module for future performance test classesModified 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 methods (Source Construction, Element Building, Class Creation, Class Metadata, Fields, Constructors, Methods, Nested Types, Class Annotations, String Generation, Formatting, File Writing)processor/.../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-testprofilePhase 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.Sample Report
Design Decisions
NoOpPerformanceTrackeris used — all methods are empty, allowing JIT to eliminate calls entirely. No boolean check per invocation.ActivePerformanceTrackerfor report display only. 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.startPhase/endPhasecalls live inside each method (e.g.,createJavaClassSource,appendFields) rather than wrapping calls inbuildClassSource, improving readability.Usage
Enable performance tracking via compiler argument:
Out of Scope (Follow-up PR)
performance-testmodule