Conversation
Add sync and async ZipArchive metadata-reading benchmarks over memory and file streams. Move the runtime-async feature gate to the repository root so BenchmarkDotNet-generated projects inherit it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d6957835-b7f3-45ee-875f-4efad68e3c4e
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The changes look correct and aligned with the stated benchmarking/build goals, with only a minor benchmark-noise improvement suggested.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/benchmarks/micro/libraries/System.IO.Compression/ZipArchive.cs — GetMetadataEntry uses LINQ (Entries.First + predicate), which adds extra overhead/allocations into… |
What changed in this PR
This pull request adds new microbenchmarks to measure ZipArchive metadata-reading performance across sync/async and memory/file-backed streams, and adjusts the build so the runtime-async feature gate is applied from the repository root (allowing BenchmarkDotNet-generated projects under artifacts/ to inherit it).
Changes:
- Added a
ZipArchivemetadata-reading benchmark that generates a representative ZIP (JSON metadata + payload entries) and measures sync vs async read paths from memory and file streams. - Moved the
runtime-asyncfeature gating logic fromsrc/Directory.Build.targetsinto the repository rootDirectory.Build.targets. - Removed the now-unneeded
src/Directory.Build.targets.
| File | Description |
|---|---|
| src/Directory.Build.targets | Removed subdirectory build targets so the root targets apply directly under src/. |
| src/benchmarks/micro/libraries/System.IO.Compression/ZipArchive.cs | New microbenchmark for reading ZIP entry metadata (sync/async, memory/file). |
| Directory.Build.targets | Added root-level runtime-async feature gating so generated BDN projects under artifacts/ inherit it. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| private static ZipArchiveEntry GetMetadataEntry(ZipArchive archive) => | ||
| archive.Entries.First(entry => entry.FullName == "package-metadata.json"); |
What's the issue with
You can also use |

Summary
ZipArchivemetadata-reading benchmarks using a generated ZIP containing JSON package metadata and payload entries.artifacts/inherit it.The public async benchmark uses a synchronous BenchmarkDotNet entrypoint around a private async workload. This avoids BenchmarkDotNet generating an
async voidrunner state machine while preserving runtime-async compilation for the measured workload.Runtime comparison
Using matched compiler-async and runtime-async benchmark builds and
System.IO.CompressionCoreRoots:The results reproduced across two paired runs. The runtime-async benchmark workload contains no generated async state machine.