Skip to content

guillermo2007/Net.Benchmark

Repository files navigation

Net.Benchmark

This project benchmarks and compares the performance of various .NET 9 collection types and demonstrates new C# features related to collections in the latest version.

Collections and Features Benchmarked

  • List<T>: Standard dynamic array.
  • HashSet<T>: Unordered set for fast lookups.
  • Dictionary<TKey,TValue>: Key-value mapping.
  • Span<T> and Memory<T>: For high-performance memory access (planned/extendable).
  • KeyValuePair<TKey,TValue>: Used in dictionary enumeration.
  • New C# 12/13 features: Including collection expressions, and LINQ methods like FirstOrDefault, LastOrDefault, etc.

How to Run

  1. Build the project in Release mode for accurate benchmarks:
    dotnet build -c Release
  2. Run the benchmarks:
    dotnet run -c Release

Benchmark Results and Artifacts

When you run the benchmarks, BenchmarkDotNet generates a folder called BenchmarkDotNet.Artifacts in the project directory. This folder contains:

  • Benchmark results: Detailed reports in Markdown, CSV, and log formats.
  • Generated code: Auto-generated code used for running the benchmarks.
  • Build outputs: Compiled binaries for each benchmark run.
  • Logs: Diagnostic and execution logs for troubleshooting.

You can review the results in the BenchmarkDotNet.Artifacts/results subfolder. These files help you analyze and compare the performance of different collections and features.

Note: The BenchmarkDotNet.Artifacts folder can be safely deleted at any time; it will be regenerated on the next benchmark run.

Extending Benchmarks

  • Add new benchmarks for additional collections or C# features in Program.cs.
  • Follow the project's coding standards: use clear and descriptive names, and document each benchmark.
  • See .github/copilot-instructions.md for workspace-specific guidance.

Requirements

  • .NET 9 SDK

For more details, see the source code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages