Skip to content

[CoreCLR] Remove assembly store decompression cache - #12780

Open
simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-measure-assembly-store-startup
Open

simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-measure-assembly-store-startup

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Sep 14, 2026

Copy link
Copy Markdown
Member

The optional decompressed assembly-store cache was introduced in #11967 after an early prototype showed promise, improving mean startup by about 49 ms. Those measurements predated the final cache format, integrity scan, and bounded background writer, and the original PR noted that the completed implementation still needed to be remeasured.

Remeasuring the current implementation on CoreCLR + trimmable typemap + Release builds shows the opposite result:

Variant Median TTID Delta Median TTFD Delta
Compression, no cache 1,973 ms baseline 2,012 ms baseline
Compression + cache 2,135 ms +162 ms (+8.2%) 2,191 ms +179 ms (+8.9%)

These results cover 40 cache-warm launches per variant across two balanced rounds. Native timing attributed roughly 173 ms to the cache-hit path versus 48 ms for direct Zstd decompression.

The cache therefore no longer delivers its intended startup speedup and instead adds persistence, mapping, integrity-validation, storage, testing, and configuration complexity. Since it is opt-in and the associated store format was never released, this removes the feature rather than carrying that complexity forward.

This change:

  • removes the native cache reader, writer, mapping, CRC validation, and cleanup code
  • removes AndroidEnableAssemblyStoreDecompressionCache and its application-config plumbing
  • removes the Android code-cache directory startup plumbing and cache-specific device test
  • removes the cache-only assembly-store content ID
  • restores assembly-store format version 3 for both CoreCLR and MonoVM
  • updates assembly-store documentation, reader support, and format coverage

Validation:

  • dotnet build src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj
  • targeted CreateAssemblyStoreTests and GenerateNativeApplicationConfigSourcesTests
  • .github/skills/read-assembly-store/tests/AssemblyStore.Tests/AssemblyStore.Tests.csproj on net10.0 and net11.0
  • arm64 CoreCLR native runtime build

The cache regresses startup in current CoreCLR Release builds and adds persistence, validation, and configuration complexity. Restore direct Zstd decompression and assembly store format version 3.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 14, 2026 10:05
@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Sep 14, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

/review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Add CoreCLR reader coverage and MonoVM regression coverage before approval.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 1 Medium severity

Open findings (1)
What changed in this PR

Removes the CoreCLR decompressed assembly-store cache and restores assembly-store format version 3 across CoreCLR and MonoVM.

Changes:

  • Removes cache persistence, native handling, configuration, startup plumbing, and device coverage.
  • Removes content IDs and updates generators, runtimes, readers, and headers.
  • Updates documentation and related tests.

Outstanding review items:

  • Add CoreCLR v3 reader fixture coverage.
  • Add MonoVM coverage to CreateAssemblyStoreTests.
File Summary
tests/​MSBuildDeviceIntegration/​Tests/​InstallAndRunTests.cs Removes cache integration coverage.
src/​Xamarin.Android.Build.Tasks/​Xamarin.Android.Common.targets Removes cache MSBuild plumbing.
src/​Xamarin.Android.Build.Tasks/​Utilities/​AssemblyStoreGenerator.cs Emits version-3 headers without content IDs.
src/​Xamarin.Android.Build.Tasks/​Utilities/​AssemblyStoreGenerator.Classes.cs Updates managed header layout.
src/​Xamarin.Android.Build.Tasks/​Utilities/​ApplicationConfigNativeAssemblyGeneratorCLR.cs Removes cache configuration emission.
src/​Xamarin.Android.Build.Tasks/​Utilities/​ApplicationConfigCLR.cs Removes the cache configuration field.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Utilities/​EnvironmentHelper.cs Updates configuration parsing expectations.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​GenerateNativeApplicationConfigSourcesTests.cs Removes cache configuration tests.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​CreateAssemblyStoreTests.cs Validates version-3 header layout.
src/​Xamarin.Android.Build.Tasks/​Tasks/​GenerateNativeApplicationConfigSources.cs Removes the cache task property.
src/​native/​mono/​xamarin-app-stub/​xamarin-app.hh Restores MonoVM format version 3.
src/​native/​clr/​xamarin-app-stub/​application_dso_stub.cc Updates the CLR configuration stub.
src/​native/​clr/​include/​xamarin-app.hh Restores CoreCLR format version 3.
src/​native/​clr/​include/​runtime-base/​android-system.hh Removes code-cache state.
src/​native/​clr/​include/​host/​assembly-store.hh Removes content-ID state.
src/​native/​clr/​include/​constants.hh Removes the code-cache directory index.
src/​native/​clr/​host/​host.cc Removes code-cache initialization.
src/​native/​clr/​host/​assembly-store.cc Removes cache implementation.
src/​java-runtime/​java/​mono/​android/​clr/​MonoPackageManager.java Removes code-cache path plumbing.
Documentation/​project-docs/​AssemblyStores.md Documents the version-3 header format.
Documentation/​building/​configuration.md Removes the obsolete cache property.
.github/​skills/​read-assembly-store/​src/​AssemblyStore/​StoreReader_V2.cs Removes version-4 and content-ID handling.
.github/​skills/​read-assembly-store/​src/​AssemblyStore/​StoreReader_V2.Classes.cs Updates reader header definitions.

{
[Test]
public void ContentIdMatchesStoreContents ()
public void CoreCLRStoreUsesVersionThreeHeader ()
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #12780

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Needs Changes

Findings: 0 errors · 1 warning · 0 suggestions

The runtime, generator, application-config, Java bootstrap, tests, and documentation consistently remove the decompression cache and restore the v3 wire layout. The benchmark rationale is clear, and the cache-specific plumbing is removed comprehensively.

The assembly-store inspection skill should retain read compatibility with v4 artifacts already produced by local and CI builds; I left that as an inline warning. I did not duplicate the existing review comment requesting MonoVM generator coverage.

CI is still running: the completed Android Tools and Java.Interop lanes plus license/cla are green, while the Linux, macOS, and Windows build lanes and aggregate pipeline have not completed.

Generated by Android PR Reviewer for #12780 · copilot · gpt56 · 156.4 AIC · ⌖ 11.3 AIC · ⊞ 21K
Comment /review to run again

Comment on lines -239 to +236
- **CoreCLR** (store format version `4`): the hash is a 32-bit
- **CoreCLR** (store format version `3`): the hash is a 32-bit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we increment to version 5, or are we sure it was the same as before?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same it was before. It was disabled so nobody used it anyway. I would treat v4 as never shipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants