Skip to content

Add BenchmarkDotNet performance benchmarking infrastructure#1111

Draft
Copilot wants to merge 8 commits into
masterfrom
copilot/add-performance-benchmarking
Draft

Add BenchmarkDotNet performance benchmarking infrastructure#1111
Copilot wants to merge 8 commits into
masterfrom
copilot/add-performance-benchmarking

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 5, 2026

Performance Benchmarks Implementation - Complete ✅

Successfully integrated BenchmarkDotNet into the SharpCompress.Performance project with comprehensive benchmarking capabilities.

Recent Updates

  • ✅ Merged latest master branch
  • ✅ Resolved merge conflicts in packages.lock.json
  • ✅ Verified benchmarks work correctly after merge

Implemented Benchmarks

  1. ArchiveReadBenchmarks - Archive API (random access) for Zip, Tar, Tar.gz, Tar.bz2, 7Zip, Rar
  2. ReaderBenchmarks - Reader API (forward-only streaming) for Zip, Tar, Tar.gz, Tar.bz2, Rar
  3. WriteBenchmarks - Writer API (forward-only writing) for Zip, Tar, Tar.gz
  4. BaselineComparisonBenchmarks - Example showing baseline comparison with ratio calculations

Features

✅ Memory diagnostics with [MemoryDiagnoser] attribute
✅ Baseline comparison support for tracking performance changes
✅ Test archives from existing TestArchives directory
✅ Comprehensive README with usage examples and best practices
✅ BenchmarkDotNet artifacts excluded from git
✅ All code formatted with CSharpier
✅ Proper exception handling with descriptive messages
✅ Path validation to prevent IndexOf returning -1
✅ Iteration cleanup to prevent file reuse affecting measurements
✅ Test files initialized in GlobalSetup to avoid initialization order issues
✅ Compatible with latest master branch changes

Usage Examples

# Run all benchmarks
dotnet run -c Release

# Run specific format
dotnet run -c Release -- --filter "*Zip*"

# Quick test (dry run)
dotnet run -c Release -- --job dry

# List all benchmarks
dotnet run -c Release -- --list tree

Sample Output

Benchmarks provide detailed metrics including:

  • Mean execution time
  • Memory allocation per operation
  • Rank and Ratio columns (when using baseline comparison)
  • Exported reports in CSV, HTML, and Markdown formats

See tests/SharpCompress.Performance/README.md for comprehensive documentation.

Original prompt

This section details on the original issue you should resolve

<issue_title>Performance benchmarks</issue_title>
<issue_description>The performance project should use benchmark.net with some snapshotting to automate benchmarking and ensure there are no major reductions in performance and actual increases can be found.</issue_description>

<agent_instructions>Reuse the Performance project and there should be a number of tests for each format like the archives in the tests. See if Benchmark.NET can compare the current to a previous nuget.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits January 5, 2026 17:27
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
…documentation

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
…on order

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copilot AI changed the title [WIP] Add performance benchmarking with Benchmark.NET Add BenchmarkDotNet performance benchmarking infrastructure Jan 5, 2026
Copilot AI requested a review from adamhathcock January 5, 2026 17:41
@adamhathcock
Copy link
Copy Markdown
Owner

@copilot merge in the latest master and resolve conflicts

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 12, 2026

@copilot merge in the latest master and resolve conflicts

Merged latest master branch and resolved conflicts in commit 80ac10a. The only conflict was in packages.lock.json which was resolved by regenerating it via dotnet restore. All benchmarks verified working after merge.

…ance-benchmarking

# Conflicts:
#	tests/SharpCompress.Performance/packages.lock.json
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.

Performance benchmarks

2 participants