Skip to content

Between .NET versions Performance-focused experiments, exploring coding patterns, framework optimizations, and micro-architectural behaviors with BenchmarkDotNet.

License

Notifications You must be signed in to change notification settings

barisozgenn/Benchmarkus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Benchmarkus .NET 6 Badge .NET 7 Badge .NET 8 Badge .NET 9 Badge .NET 10 Badge BenchmarkDotNet Badge Status: Experimental

Overview

PRs Welcome Overview
Benchmarkus by Baris Ozgen Hobby experiements Benchmarkus is a performance-focused experimental project by barisozgenn. It leverages .NET (6, 7, 8, 9, 10) and BenchmarkDotNet to explore how various coding patterns, framework features, runtime behaviors, and system-level optimizations influence application performance. The goal is to help developers discover insights and best practices to build faster, more efficient .NET applications.

Key Objectives

  • Analyze Different Approaches: Compare memory usage, throughput, allocation rates, and timing differences across multiple implementations (e.g., record vs. abstract class).
  • Evaluate Patterns & Techniques: Investigate how common architectural patterns or coding idioms perform under real-world and synthetic workloads.
  • Discover Optimizations: Pinpoint subtle coding changes that significantly impact runtime efficiency, from micro-optimizations to broad architectural improvements. Identify subtle changes that impact runtime efficiency, from micro-optimizations to improvements in asynchronous code or data processing strategies.

Repository Structure

Project Description
AsyncSyncTPL Async/await overhead, TPL (Task Parallel Library), and various concurrency primitives.
BaseRecordAbstractDtos Benchmarks comparing record types, base classes, and abstract classes for data models.
CollectionOperations Various operations on collections (sorting, searching, filtering, etc.).
Common Shared utilities, extensions, and helpers used across multiple benchmark projects.
DataStructureOperations Benchmarks focusing on core data structures like lists, dictionaries, etc.
DynamicClassGeneration Reflection-based dynamic types and runtime code generation performance tests.
GuardNullCheckerAttributes Null-check and guard-clause attribute experiments for safer, more robust code.
JsonOperations Benchmarks assessing JSON operations (System.Text vs Newtonsoft) performance.
LINQsQueryApproaches LINQ, PLINQ, SpanLinq, StructLinq, imperative loops comparisons.
ListOperations Performance comparisons using different List manipulation strategies.
ModelMapping Assessing overhead of various object-to-object mapping patterns (e.g., AutoMapper).
ReflectionAOTAccessor Exploring reflection, AOT scenarios, and advanced dynamic method calls.
SortingAlgorithms Traditional sorting algorithms (e.g., QuickSort, MergeSort) compared head-to-head.
StringOperations String manipulation, concatenation, parsing, and related benchmarks.
UnmanagedTypesOperations Experiments with unmanaged memory, span usage, and low-level .NET performance.

Upcoming Benchmark Areas & .NET 10 Enhancements

Project Description
AsyncEnhancements Investigate advanced asynchronous patterns and the latest async improvements introduced in .NET 10.
MemoryOptimizedCollections Benchmark high-performance collections leveraging .NET 10's runtime optimizations and memory management improvements.
SourceGenerators Evaluate the performance impact of source generators and code analysis enhancements, particularly as they mature in .NET 10.
MinimalAPIsAdvanced Compare the performance and scalability of .NET 10's new Minimal APIs against traditional approaches in web and microservices.
CloudNativePatterns Explore microservice and cloud-native design patterns, including enhancements in gRPC, HTTP/3, and container-optimized runtimes.
MemoryAndGCTuning Analyze memory allocation patterns, compare different Garbage Collector (GC) modes (server vs. workstation), and benchmark high-performance types like Span and Memory.
SerializationDataTransfer Extend JSON benchmarks by exploring alternative serialization formats (e.g., Protobuf, MessagePack) and comparing custom serialization techniques with traditional approaches.
DynamicExpressionOperations Benchmark the construction and compilation of expression trees and dynamically generated lambda expressions versus their statically compiled counterparts.
FrameworkAPIBenchmarks Analyze performance differences between data access strategies like EF Core, Dapper, and other micro-ORMs, along with benchmarking .NET Minimal APIs and microservice endpoints.
NewLanguageAndRuntime Benchmark advanced C# features (pattern matching, switch expressions) and assess .NET runtime improvements across versions, including JIT enhancements and hardware intrinsics.
RealWorldEndToEndScenarios Create benchmarks simulating realistic application workloads (e.g., web request handling, microservice orchestration, data processing pipelines) and evaluate cross-platform differences.

Note: These projects are planned for future releases and will help expand Benchmarkus into a comprehensive performance exploration toolkit, keeping it aligned with the latest .NET 10 features and beyond.


What’s Inside

  • Broad Performance Coverage
    From simple operations (like basic arithmetic, string manipulation, or data transfers) to more advanced architectural patterns (such as object mappers, dynamic code generation, or specialized data structures), Benchmarkus offers a wide array of performance scenarios. This coverage helps you understand how different strategies hold up under various loads, data sets, and runtime conditions.

  • Methodology & Best Practices
    Each benchmark follows a carefully structured approach to measurement, isolating the code under test to produce meaningful and reproducible results. The repository demonstrates the importance of proper warmup, iteration counts, and avoidance of confounding factors (like JIT caching) to ensure you can trust the data collected. Additionally, it encourages best practices such as parameterization, consistent environment setups, and systematic reporting of results.

  • Dynamic Experimentation
    Whether you want to experiment with new coding patterns, test the effects of feature toggles, or compare multiple object creation strategies, Benchmarkus offers a dynamic playground. You can easily modify or add benchmarks to explore new ideas without committing to a single approach, giving you the freedom to explore .NET’s capabilities in a controlled environment.


Goals

  • Practical Insights
    By diving deep into real-world performance scenarios, the benchmarks in Benchmarkus illuminate which coding patterns offer the best tradeoffs. Rather than relying on abstract theory or guesswork, you’ll see concrete numbers on memory usage, throughput, and CPU time, helping you decide what may (or may not) be more efficient.

  • Informed Decision-Making
    Data-driven insights are crucial when choosing between competing design patterns, libraries, or runtime features. Benchmarkus aims to reduce the guesswork by providing quantitative evidence to support or refute assumptions. Developers can leverage these results to guide architectural decisions, refactor priorities, or technology selections with more confidence.

  • Community Involvement
    Benchmarkus invites contributions from the broader .NET community. By sharing test cases, optimization techniques, or novel approaches, everyone benefits from a richer dataset and more robust comparisons. The repository’s collaborative nature fosters collective experimentation and learning, ensuring that knowledge is continuously updated and refined.


Why Benchmarkus?

  1. Broad Performance Coverage
    Covers everything from data structures and collection operations to reflection and dynamic class generation.

  2. Methodology & Best Practices
    Encourages systematic measurement, proper environment setup, and reproducible results via BenchmarkDotNet.

  3. Dynamic Experimentation
    Allows developers to add or modify benchmarks easily, testing new .NET features, patterns, or libraries.

  4. Community Involvement
    Contributions and pull requests are welcome! Share your scenarios, code patterns, or optimization ideas.


Contributing

  • Pull Requests: PRs are always welcome. Please ensure benchmarks produce deterministic results and follow standard best practices for measurement.
  • Issues & Feedback: Use the issue tracker to report bugs, request new benchmarks, or share any feedback.

Benchmark Environment

All benchmarks in this repository are run with BenchmarkDotNet v0.14.0 on:

  • macOS Sequoia 15.3 (24D60) [Darwin 24.3.0]
  • Apple M2, 1 CPU, 8 logical and 8 physical cores, Arm64 RyuJIT AdvSIMD

Note: Results may vary on different operating systems or hardware configurations or benchmark configurations.


License

This project is licensed under the MIT License.


Stay Connected


Happy benchmarking!

Releases

No releases published

Packages

No packages published

Languages