Skip to content

[cDAC] Optimize processed data cache keys - #137311

Merged
max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:cdac-idata-cache-key
Nov 17, 2026
Merged

max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:cdac-idata-cache-key

Conversation

@max-charlamb

Copy link
Copy Markdown
Member

Summary

  • Use RuntimeTypeHandle instead of Type in the processed-data cache key.
  • Preserve the existing address-plus-exact-type cache identity, creation behavior, reentrant insertion handling, and flush semantics.
  • Allow NativeAOT to specialize the all-value-type dictionary key and avoid materializing a runtime Type for each cache lookup.

Performance

Measured the Windows x64 NativeAOT dump-enumeration provider against an exact main baseline built from 228e8fbb9d9. The focused results combine both provider orders; each order used 3 launches, 5 warmup iterations, and 30 measured iterations.

Heap scenario Main This PR Improvement
CodeHeavy 6.189 ms 5.926 ms 4.3%
DeepStacks 21.808 ms 20.473 ms 6.1%
LargeComplex 16.391 ms 15.518 ms 5.3%

An all-case screen covered all 18 combinations of six snapshots and Mini, Heap, and Triage modes. Seventeen improved in the initial screen. The remaining SmallComplex Heap case was remeasured in both provider orders and improved by 4.8%; no confirmed regressions remain.

NativeAOT code size for the affected methods also decreased:

Method Main This PR
Processed-data dictionary FindValue 571 bytes 362 bytes
DataCache.GetOrAdd<T> 211 bytes 196 bytes
DataCache.TryGet<T> 168 bytes 143 bytes

The published NativeAOT provider decreased from 3,640,320 to 3,639,808 bytes (-512 bytes).

Validation

  • dotnet test src\native\managed\cdac\tests\UnitTests\Microsoft.Diagnostics.DataContractReader.Tests.csproj -c Release -m:1 -p:BuildInParallel=false -- passed, 4,070 tests.
  • Compared all 18 dump-enumeration cases against main -- every emitted range and update payload was identical.
  • git diff --check -- passed.

Note

This PR description was generated with GitHub Copilot.

Allow NativeAOT to specialize the processed-data dictionary key and avoid materializing RuntimeType objects on cache lookups.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: de3eab4e-b090-430a-8e30-6b204fb1519a
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@max-charlamb
max-charlamb merged commit ebe047e into dotnet:main Nov 17, 2026
91 of 93 checks passed
@max-charlamb
max-charlamb deleted the cdac-idata-cache-key branch November 17, 2026 22:16
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants