@@ -146,21 +146,21 @@ dotnet run -c=Release --project=Benchmarking
146146```
147147
148148### Quick performance comparison between relevant collection types
149- | Task | List | DictionaryList | Dictionary | SortedDictionary |
150- | -------------------------------------| --------| ----------------| ------------| ------------------|
151- | Append Many Items (speed) | 👍 | 👌 | 👎👎 | 👎👎👎 |
152- | Append Many Items (memory) | 👍 | 👌 | 👎👎 | 👎 |
153- | Full Iteration (speed) | 👍 | 👎 | 👌 | 👎👎 |
154- | Full Iteration (memory) | 👍 (0) | 👌 | 👍 (0) | 👌 |
155- | Read Many Items (speed) | 👍 | 👌 | 👎 | 👎👎 |
156- | Read Many Items (memory) | 👍 (0) | 👍 (0) | 👍 (0) | 👍 (0) |
157- | Remove Many Items In-place (speed) | 👎👎👎 | 👌 | 👍 | 👌 |
158- | Remove Many Items In-place (memory) | 👍 (0) | 👌 | 👍 (0) | 👌 |
159- | Remove Many Items w/ LINQ (speed) | 👍 | 👌 | 👎👎 | 👎👎 |
160- | Remove Many Items w/ LINQ (memory) | 👍 | 👌 | 👎 | 👎👎 |
161- | Emit Key/Index During ` foreach ` | ❌ | ✔️ | ✔️ | ✔️ |
162- | Update Items During ` foreach ` | 🤷 | ✔️ | ✔️ | ❌ key exists |
163- | Remove Items During ` foreach ` | ❌ | ✔️ | ✔️ | ❌ |
149+ | Task | List | DictionaryList | Dictionary | SortedDictionary |
150+ | -------------------------------------| ---------- | ----------------| ------------| ------------------|
151+ | Append Many Items (speed) | 👍 | 👌 | 👎👎 | 👎👎👎 |
152+ | Append Many Items (memory) | 👍 | 👌 | 👎👎 | 👎 |
153+ | Full Iteration (speed) | 👍 | 👎 | 👌 | 👎👎 |
154+ | Full Iteration (memory) | 👍 (0) | 👌 | 👍 (0) | 👌 |
155+ | Read Many Items (speed) | 👍 | 👌 | 👎 | 👎👎 |
156+ | Read Many Items (memory) | 👍 (0) | 👍 (0) | 👍 (0) | 👍 (0) |
157+ | Remove Many Items In-place (speed) | 👎👎👎 | 👌 | 👍 | 👌 |
158+ | Remove Many Items In-place (memory) | 👍 (0) | 👌 | 👍 (0) | 👌 |
159+ | Remove Many Items w/ LINQ (speed) | 👍 | 👌 | 👎👎 | 👎👎 |
160+ | Remove Many Items w/ LINQ (memory) | 👍 | 👌 | 👎 | 👎👎 |
161+ | Emit Key/Index During ` foreach ` | 🤷 ( [ 1 ] ) | ✔️ | ✔️ | ✔️ |
162+ | Replace Items During ` foreach ` | 🤷 ( [ 1 ] ) | ✔️ | ✔️ | ❌ if key exists |
163+ | Remove Items During ` foreach ` | ❌ | ✔️ | ✔️ | ❌ |
164164
165165You may see that ` DictionaryList<T> ` is an all-rounded, midway solution between a ` List<T> ` and a ` Dictionary<TKey,TValue> ` .
166166
@@ -180,6 +180,9 @@ Run the tests with:
180180dotnet test
181181```
182182
183+ ## Appendix
184+ [ 1] Technically, this can be done with Enumerable LINQ's Index method, but using LINQ with ` foreach ` is perhaps an antipattern.
185+
183186[ nuget-url ] : https://www.nuget.org/packages/Vectorial1024.DictionaryList/
184187[ nuget-stats-url ] : https://www.nuget.org/stats/packages/Vectorial1024.DictionaryList?groupby=Version
185188[ github-repo-url ] : https://github.com/Vectorial1024/DictionaryList
0 commit comments