3 ms·
I like the various .NET dictionaries but have been unimpressed by their performance. So how das it compare to Dictionary<TKey, TValue>? Given that operations o
by danbruc 8y ago
I like the various .NET dictionaries but have been unimpressed by their performance.
So how das it compare to Dictionary<TKey, TValue>? Given that operations on a balanced search tree are O(log(n)) while they are O(1) amortized - and O(n) worst case - on a hash-based dictionary, it doesn't seems too plausible that even a fast implementation could score a win. Not to mention the much worse locality of a tree. In some rare scenarios having O(n) worst case performance might be an issue but unless you actually need an ordered dictionary I have a hard time believing that a tree-based implementation can outperform a hash-based implementation.