Skip to content

update benchmarks to include async paths#1202

Merged
adamhathcock merged 5 commits intomasterfrom
adam/async-benchmarks
Feb 12, 2026
Merged

update benchmarks to include async paths#1202
adamhathcock merged 5 commits intomasterfrom
adam/async-benchmarks

Conversation

@adamhathcock
Copy link
Owner

This pull request adds comprehensive async benchmarks and updates documentation to clarify async API usage in the SharpCompress performance suite. It introduces async variants for all major archive operations (read and write) across supported formats, and updates documentation to guide users on when to use async APIs and common pitfalls.

Async Benchmarking Enhancements:

  • Added async benchmark methods for extraction and creation operations in GZipBenchmarks.cs, RarBenchmarks.cs, SevenZipBenchmarks.cs, TarBenchmarks.cs, and ZipBenchmarks.cs, covering both Archive and Reader APIs as well as write scenarios. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Documentation Updates:

  • Updated AGENTS.md to document new async factory methods (OpenAsyncArchive, OpenAsyncReader, OpenAsyncWriter) and provide guidance on async usage patterns and pitfalls. [1] [2] [3]
  • Enhanced the README.md for the performance benchmarks to clearly indicate coverage of both sync and async scenarios for each archive format.

Benchmark Configuration Improvements:

  • Increased the default warmup and iteration counts in the benchmark configuration for more robust performance measurements.

Codebase Preparation:

  • Added necessary using System.Threading.Tasks; directives to all affected benchmark files to support async methods. [1] [2] [3] [4] [5]

Copilot AI review requested due to automatic review settings February 11, 2026 13:37
@kiloconnect
Copy link
Contributor

kiloconnect bot commented Feb 11, 2026

Code Review Summary

Status: 4 New Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
tests/SharpCompress.Performance/Benchmarks/SevenZipBenchmarks.cs 40 Inconsistent async archive usage - uses OpenAsyncArchive with sync Entries instead of EntriesAsync
tests/SharpCompress.Performance/Benchmarks/SevenZipBenchmarks.cs 77 Unused reader variable - creates reader but iterates over archive directly

SUGGESTION

File Line Issue
tests/SharpCompress.Performance/Benchmarks/SevenZipBenchmarks.cs 90 Missing space before opening parenthesis - while( should be while (
tests/SharpCompress.Performance/Benchmarks/TarBenchmarks.cs 135 Unused variable entry - serves no purpose and can be removed
Other Observations (not in diff)

No issues found in unchanged code.

Files Reviewed (8 files)
  • AGENTS.md - Documentation updates (no issues)
  • tests/SharpCompress.Performance/Benchmarks/GZipBenchmarks.cs - New async benchmarks (no issues)
  • tests/SharpCompress.Performance/Benchmarks/RarBenchmarks.cs - New async benchmarks (no issues)
  • tests/SharpCompress.Performance/Benchmarks/SevenZipBenchmarks.cs - 3 issues found
  • tests/SharpCompress.Performance/Benchmarks/TarBenchmarks.cs - 1 issue found
  • tests/SharpCompress.Performance/Benchmarks/ZipBenchmarks.cs - New async benchmarks (no issues)
  • tests/SharpCompress.Performance/Program.cs - Benchmark config updates (no issues)
  • tests/SharpCompress.Performance/README.md - Documentation updates (no issues)
  • tests/SharpCompress.Performance/baseline-results.md - Results update (no issues)

Fix these issues in Kilo Cloud

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds comprehensive async benchmarks for all major SharpCompress archive operations, providing performance measurements for both sync and async code paths. It also updates documentation to guide users on async API usage patterns and common pitfalls.

Changes:

  • Added async benchmark variants for all archive format operations (GZip, Rar, 7Zip, Tar, Zip) covering Archive API, Reader API, and Writer API
  • Updated AGENTS.md to document async factory methods and best practices for async usage
  • Enhanced benchmark configuration with increased warmup and iteration counts for more robust measurements
  • Updated baseline results with performance data from new async benchmarks

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/SharpCompress.Performance/Benchmarks/GZipBenchmarks.cs Added async compress and decompress benchmarks
tests/SharpCompress.Performance/Benchmarks/RarBenchmarks.cs Added async Archive and Reader API extraction benchmarks
tests/SharpCompress.Performance/Benchmarks/SevenZipBenchmarks.cs Added async LZMA, LZMA2, and LZMA2 Reader extraction benchmarks
tests/SharpCompress.Performance/Benchmarks/TarBenchmarks.cs Added async Archive API, Reader API, TarGzip, and create benchmarks
tests/SharpCompress.Performance/Benchmarks/ZipBenchmarks.cs Added async Archive API, Reader API, and create benchmarks
tests/SharpCompress.Performance/Program.cs Increased warmup (3→5), iteration (10→30), invocation (10→30) counts and unroll factor (1→2)
tests/SharpCompress.Performance/README.md Updated format descriptions to indicate sync and async variants
tests/SharpCompress.Performance/baseline-results.md Updated with new benchmark results including async variants
AGENTS.md Documented async factory methods and added guidance on async usage patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Adam Hathcock and others added 2 commits February 11, 2026 13:57
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 11, 2026 14:00
{
using var stream = new MemoryStream(_lzmaBytes);
await using var archive = SevenZipArchive.OpenAsyncArchive(stream);
foreach (var entry in archive.Entries.Where(e => !e.IsDirectory))
Copy link
Contributor

Choose a reason for hiding this comment

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

WARNING: Inconsistent async archive usage. This benchmark uses OpenAsyncArchive (async) with archive.Entries (sync) instead of archive.EntriesAsync. Per AGENTS.md guidelines, async scenarios should use EntriesAsync with await foreach for proper async enumeration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant