Group generated renderers into hash-assigned source files for incremental compilation - #59
Merged
Merged
Conversation
Each renderer now carries its own STATIC bytes and references neither the registry nor other renderers, so an unchanged template regenerates byte-identical files and Gradle's incremental Java compilation recompiles only the renderer whose template changed plus the registry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…mental javac Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Per-template files made KSP about 1.1 s slower in ReAI because KSP registers every generated Java file; Thim's own generation only grew by 0.2 s. Renderers are now grouped into 32 files by a stable hash of the page-model name, each with its own static resource, so an edit recompiles one file of roughly ten renderers and KSP sees 32 files. Golden renders recorded with the 0.11.2 compiler prove the output is byte-identical. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
javac's auxiliary-class lint, fatal under -Werror in one ReAI module, rejects package-private top-level classes referenced from another source file. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Author
|
Full edit loop on ReAI (
Kotlin's incremental compilation also benefits, since only one Java file on its source path changes. KSP is now the dominant cost of a template edit, so the next step for the edit loop is inside the processor (property-lookup caching, or skipping regeneration for unchanged templates), not javac. Upgrade transition verified with |
Merged
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.
Summary
Renderers are generated into 32 source files chosen by a stable hash of the page-model name (
<Registry>Part<n>), each with a holder class that owns the file's static resource. Renderers nest in their holder and reference only itsSTATIC; the registry is the only file that references every renderer. An unchanged file regenerates byte-identical output, so Gradle's incremental Java compilation recompiles one file plus the registry, and Kotlin's incremental compilation sees one changed Java source. KSP dependencies stay aggregating.Measured on ReAI (344 renderers, warm daemon,
--no-build-cache)::web-app:kspKotlin:web-app:compileKotlin:web-app:compileJavaFull
:web-app:compileJava: 6.3 s → 2.8 s. Static resources: 1.6 MB → 2.8 MB (deduplicated per file instead of per module).Correctness
GoldenRenderTest: twelve renders (four example pages, three locales, form errors, 64-byte output buffer) recorded with the 0.11.2 compiler and compared byte for byte.-Werror).What was tried and rejected
compileJava0.27 s, but KSP grew 2.9 s → 4.5 s because it registers every generated Java file (Thim's own generation only grew by 0.23 s;Dependencies.ALL_FILESchanged nothing), and resources grew to 6.5 MB.-Werror.ThimRenderersuffix: Gradle's previous-compilation data kept listing every renderer underThimTemplates.java, so the first post-upgrade edit deleted all class files and retrying did not recover.Details in
PERFORMANCE_AUDIT.md.🤖 Generated with Claude Code