Repository navigation
Reuse generated stunts across builds and projects while their types keep their shape - #318
Merged
Merged
Conversation
…eep their shape. Stunts are cached in .vs/stunts-cache at the git root (from source control information), keyed by a fingerprint of the generator, the compilation-wide inputs processors read, and the declarations and member signatures of the stunt's types. Unchanged rebuilds skip processing entirely, and test projects consuming the same interfaces share the entries. Co-authored-by: CodeAlta <noreply@codealta.io> Co-authored-by: Cursor <cursoragent@cursor.com>
kzu
force-pushed
the
feat/stunts-cache
branch
from
October 27, 2026 02:20
60af060 to
aa3a182
Compare
kzu
enabled auto-merge (rebase)
October 27, 2026 02:21
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.
Rebuilds where the types behind a stunt haven't changed (no new type definitions or member signatures) now reuse the code generated by an earlier build instead of running the processor pipeline again. Projects in the same repository share the cache, so test projects using the same core interfaces generate them only once.
How it works
Where:
Stunts.targetssets the compiler-visibleStuntsCacheDirto.vs/stunts-cache/at the git repository root. The root comes from the gitSourceRootthatInitializeSourceControlInformationresolves, the same approach as ThisAssembly.Git. If there is no git root it uses the solution directory, thenobj/stunts-cache/. SetEnableStuntsCache=falseto turn the cache off.Key (
StuntFingerprint): a SHA256 over:Types used in signatures contribute only their shape, not their members. Assemblies contribute only their relation to the compilation (
self, friend or other), so rebuilt or re-versioned libraries keep their entries.Storage (
StuntCache):.stuntfile per key, in a folder per generator version;Replay: cached entries replay ST006/ST015 and the unchanged-scaffold skip. Default interface implementation classes are cached under their own keys. Registration still runs every time, so delegate and nested stunts get their forwarders from the cached text.
Caching is disabled when processors from other assemblies are configured, since their inputs are unknown.
Numbers (400 metadata stunts, generator only)
Tests
StuntCacheTests(11 tests) covers:The full unit suite passes (368 tests). I checked
StuntsCacheDirresolution with scratch projects in a repository, in a worktree, outside git, withSolutionDir, and with the cache disabled.This pull request was created by CodeAlta, an AI coding agent.