dotnet / dotnet/android

[TrimmableTypeMap] Parallelize assembly index construction during Java peer scanning

Open
#11,491 0 comments 0 reactions 0 assignees View on GitHub
copilot trimmable-type-map
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 20h
Merged PRs (30d)
257

Description

Part of #10958.

Assembly scanning is still eager and sequential. `JavaPeerScanner.Scan(...)` first calls `AssemblyIndex.Create(...)` for every assembly, then scans every populated index. This issue tracks a safe first step: parallelizing the independent index-building portion and documenting/refactoring any shared-state blockers for later scan parallelism.

## Current locations

- `src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/JavaPeerScanner.cs`
- `Scan(...)` builds all `AssemblyIndex` instances serially, stores them in `assemblyCache`, then scans each index.
- `src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/AssemblyIndex.cs`
- `AssemblyIndex.Create(...)` builds one assembly index from a `PEReader` and assembly name.

## Suggested implementation

- Start with parallelizing `AssemblyIndex.Create(...)`, since each assembly index is independent.
- Merge results back into `assemblyCache` deterministically after parallel work completes.
- Preserve scan/result ordering where it affects generated output.
- Do not parallelize later phases that mutate shared dictionaries/caches until they are made thread-safe or refactored.

## Acceptance criteria

- Assembly index construction can run in parallel without changing generated typemap/manifest/JCW output.
- Output remains deterministic.
- Add or update tests as needed to cover stable output with multiple input assemblies.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.