Home

Awesome

Performance Wars Benchmarking - C#

This repository contains a collection of C# benchmarks to compare the performance of different approaches to solve the same problem.

  1. List.TrimExess() Benchmark
  2. for vs foreach vs ForEach() Benchmark
  3. Reflection/Class vs NonReflection/Struct Benchmark
  4. Normal flow vs Throw Exception Benchmark
  5. String Replace Benchmark
  6. Ctor Instantiate vs Lazy Instantiaten
  7. Prometheus-net metrics Benchmark
  8. PropertyGetter Benchmark
  9. Reverse string Benchmark
  10. Concat string Benchmark
  11. Word reverse Benchmark
  12. OrderBy.First/Last vs Min/Max Benchmark
  13. Collection Shuffle Benchmark
  14. FileStream Write vs WriteAsync Benchmark
  15. Stream Read Bytes Benchmark
  16. Stream Write Bytes Benchmark
  17. Stream Read String Benchmark
  18. Array Allocating Benchmark
  19. Array Resizing Benchmark
  20. String StartWith Benchmark
  21. GetHashCode and Equals Benchmark
  22. Enumerable NullOrEmpty Benchmark
  23. .NET Collections Benchmark⭐️
  24. Converting Enum To String Benchmark
  25. Array Copy Benchmark
  26. String Find First Duplicate Char Benchmark
  27. Convert Number To Base62 String Benchmark
  28. MediatR vs Mediator vs SlimMediator Benchmark
  29. AggressiveInlining Benchmark
  30. New Instantiate Benchmark

TODO

Some ideas for future benchmarks:

Contributing

Create an issue or discussion if you found a Mistake or have a Suggestion.

Or if you want to add more benchmarks to this project:

  1. Fork it
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Useful Resources