{"id":26673740,"url":"https://github.com/mjebrahimi/performance-wars-benchmarking-csharp","last_synced_at":"2025-04-12T06:14:06.381Z","repository":{"id":110225071,"uuid":"253220322","full_name":"mjebrahimi/Performance-Wars-Benchmarking-CSharp","owner":"mjebrahimi","description":"🔥Performance Wars Benchmarking C# - This repository contains a collection of C# benchmarks to compare the performance of different approaches to solve the same problem.","archived":false,"fork":false,"pushed_at":"2024-08-21T16:16:09.000Z","size":4862,"stargazers_count":51,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T06:14:01.757Z","etag":null,"topics":["benchmark","benchmarking","csharp","dotnet","performance","performance-optimization"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjebrahimi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-05T11:37:25.000Z","updated_at":"2025-04-07T19:31:55.000Z","dependencies_parsed_at":"2023-12-05T17:45:19.688Z","dependency_job_id":"dcb2b8c6-77ca-4359-ad81-8d73fcf692cb","html_url":"https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FPerformance-Wars-Benchmarking-CSharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FPerformance-Wars-Benchmarking-CSharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FPerformance-Wars-Benchmarking-CSharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjebrahimi%2FPerformance-Wars-Benchmarking-CSharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjebrahimi","download_url":"https://codeload.github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525138,"owners_count":21118619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","benchmarking","csharp","dotnet","performance","performance-optimization"],"created_at":"2025-03-26T01:37:31.751Z","updated_at":"2025-04-12T06:14:06.362Z","avatar_url":"https://github.com/mjebrahimi.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Performance Wars Benchmarking - C\\#\n\nThis repository contains a collection of C# benchmarks to compare the performance of different approaches to solve the same problem.\n\n1. [List.TrimExess() Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/List-TrimExess-Benchmark)\n2. [for vs foreach vs ForEach() Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/For-ForEach-Benchmark)\n3. [Reflection/Class vs NonReflection/Struct Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Reflection-NonReflection-Benchmark)\n4. [Normal flow vs Throw Exception Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Throw-Exception-Benchmark)\n5. [String Replace Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/String-Replace-Benchmark)\n6. [Ctor Instantiate vs Lazy Instantiaten](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/New-Lazy-Instantiate)\n7. [Prometheus-net metrics Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Metrics-Benchmark)\n8. [PropertyGetter Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Property-Getter-Benchmark)\n9. [Reverse string Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/String-Reverse-Benchmark)\n10. [Concat string Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/String-Concat-Benchmark)\n11. [Word reverse Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Word-Reverse-Benchmark)\n12. [OrderBy.First/Last vs Min/Max Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/OrderByFirstLast-MinMax-Benchmark)\n13. [Collection Shuffle Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Collection-Shuffle-Benchmark)\n14. [FileStream Write vs WriteAsync Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/FileStream-WriteAsync-Benchmark)\n15. [Stream Read Bytes Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Stream-Read-Bytes-Benchmark)\n16. [Stream Write Bytes Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Stream-Write-Bytes-Benchmark)\n17. [Stream Read String Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Stream-Read-String-Benchmark)\n18. [Array Allocating Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Array-Allocating-Benchmark)\n19. [Array Resizing Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Array-Resizing-Benchmark)\n20. [String StartWith Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/String-StartWith-Benchmark)\n21. [GetHashCode and Equals Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/GetHashCode-Equals-Benchmark)\n22. [Enumerable NullOrEmpty Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Enumerable-NullOrEmpty-Benchmark)\n23. [.NET Collections Benchmark](https://github.com/mjebrahimi/DotNet-Collections-Benchmark/)⭐️\n24. [Converting Enum To String Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Convert-Enum-To-String-Benchmark)\n25. [Array Copy Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Array-Copy-Benchmark)\n26. [String Find First Duplicate Char Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/String-FirstDuplicateChar-Benchmark)\n27. [Convert Number To Base62 String Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Convert-To-Base62-Benchmark)\n28. [MediatR vs Mediator vs SlimMediator Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/Mediators-Benchmark)\n29. [AggressiveInlining Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/AggressiveInlining-Benchmark)\n30. [New Instantiate Benchmark](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/tree/master/New-Instantiate-Benchmark)\n\n## TODO\n\nSome ideas for future benchmarks:\n\n- [ ] [SearchValues](https://learn.microsoft.com/en-us/dotnet/api/system.buffers.searchvalues-1) vs Regex and other Alternatives\n- [ ] [UnsafeAccessor](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.unsafeaccessorattribute) vs Reflection-Based Access\n- [ ] [Source Generated Regex](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.unsafeaccessorattribute) vs Regular Regex (in various manner: static, instance, compiled, ...)\n\n## Contributing\n\nCreate an [issue](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/issues/new) or [discussion](https://github.com/mjebrahimi/Performance-Wars-Benchmarking-CSharp/discussions/new/choose) if you found a **Mistake** or have a **Suggestion**.\n\n**Or if you want to add more benchmarks to this project:**\n\n1. Fork it\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request\n\n## Useful Resources\n\n- https://github.com/martinstm/benchmarks\n- https://github.com/MarkCiliaVincenti/AsyncKeyedLockBenchmarks and [AsyncNonKeyedLockBenchmarks](https://github.com/MarkCiliaVincenti/AsyncNonKeyedLockBenchmarks) and [AsyncLock.cs](https://github.com/mjebrahimi/SmartCacheManager/blob/master/SmartCacheManager/Utilities/AsyncLock.cs) \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjebrahimi%2Fperformance-wars-benchmarking-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjebrahimi%2Fperformance-wars-benchmarking-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjebrahimi%2Fperformance-wars-benchmarking-csharp/lists"}