Awesome
.NET Collections Benchmark
A comprehensive performance comparison benchmark between different .NET collections.
If you are working with small collections (e.g. 100 items) or your code is not HOT path (not executed frequently), it's not a big deal and you usually don't need to worry about your collection's performance. (It's better not to waste your time with premature micro-optimizations)
However, if you are dealing with Large collections (e.g. 100K, 1M, or more items) or your code is HOT path (executed frequently), you should be obsessed with performance and choosing the best collection type based on your needs and conditions.
This benchmark report helps you to choose the best collection type in terms of performance based on your needs and conditions.
Give it a Star! ⭐️
If you find this repository useful and like it, why not give it a star? if not, never mind! :)
Benchmarks
- Benchmark of Collection Searching (Contains method) in terms of Execution Time (Mean)
- Benchmark of Collection Searching (Contains method) in terms of Allocation Size
- Benchmark of Collection Initializing in terms of Execution Time (Mean)
- Benchmark of Collection Initializing in terms of Allocation Size
- Benchmark of Collection Searching (TryGetValue method) in terms of Execution Time (Mean)
- Benchmark of Collection Searching (TryGetValue method) in terms of Allocation Size
Benchmark of Collection Searching (Contains method) in terms of Execution Time (Mean)
- Visit HTML Page
- Visit Full Image
Benchmark of Collection Searching (Contains method) in terms of Allocation Size
- Visit HTML Page
- Visit Full Image
Benchmark of Collection Initializing in terms of Execution Time (Mean)
- Visit HTML Page
- Visit Full Image
Benchmark of Collection Initializing in terms of Allocation Size
- Visit HTML Page
- Visit Full Image
Benchmark of Collection Searching (TryGetValue method) in terms of Execution Time (Mean)
- Visit HTML Page
- Visit Full Image
Benchmark of Collection Searching (TryGetValue method) in terms of Allocation Size
- Visit HTML Page
- Visit Full Image
BenchmarkDotNetVisualizer🌈
All the benchmarks are created by BenchmarkDotNetVisualizer.
Todo
- Add .NET 9.0 OrderedDictionary to the benchmarks
- Add benchmarks for other operations such as Add, Insert, Remove, and Update.