Repository navigation
Pool argument states to reduce application size - #521
Merged
eiriktsarpalis merged 14 commits intoOct 9, 2026
Merged
Conversation
Add opt-in class-backed argument states for smaller Native AOT output, with explicit pooling return semantics and benchmark coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move pooling behavior to a dedicated interface and make the optimization-mode fixture compile with older language versions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #521 +/- ##
==========================================
+ Coverage 94.29% 94.33% +0.03%
==========================================
Files 255 258 +3
Lines 17277 17516 +239
Branches 3361 3393 +32
==========================================
+ Hits 16292 16523 +231
- Misses 747 751 +4
- Partials 238 242 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pe-app-size-generation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
eiriktsarpalis
force-pushed
the
eiriktsarpalis-polytype-app-size-generation
branch
from
October 7, 2026 18:08
9565cfd to
b47629c
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Retain reference clearing, selectively inline returns, and initialize reused bitsets once. Align constructor snapshots across frameworks and simplify test-only release helpers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep pooled generated/emit states, use a dedicated non-pooled reflection state, and preserve the measured small-state initialization hints. Target the canonical app at .NET 11 with representative JSON and configuration-binding shapes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the measured Linux x64, Windows x64, and macOS ARM64 image sizes from the e865b64 Release matrix. Remove pending-baseline notices without changing tolerance settings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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
Reduce Native AOT generic specialization by using pooled class-backed argument states for source-generated and Reflection.Emit constructors, methods, and functions.
IArgumentState.Return()and PT0033 to enforce constructor-state cleanup; generated function wrappers return states infinally.ReflectionArgumentState.Native AOT size improvement
The representative canary is 24.55–25.57% smaller than
main(45dd35c). Each platform builds both library versions with identical application source and publish settings:9a0be57)Native measurements use the pinned .NET 11 RC SDK, Release size optimization, invariant globalization, and disabled stack traces. Each runner repeated publishes in reverse order with identical sizes and successful JSON/configuration round trips. This is a file-size comparison, not a throughput claim.
Validation
make test,make pack, andmake test-aot-sizepass. CI is green across all six Linux/Windows/macOS Debug/Release jobs, including native-size checks. Markdown and Codecov checks also pass.