I'm looking at several IoC contains in order to choose one to use in my work, and taking a look at LightInject's codebase I came across something I don't understand...
In ServiceContainer's GetInstance(Type serviceType, string serviceName)
method, it forms a key from the parameters and calls 'Search' on 'namedDelegates':
var key = Tuple.Create(serviceType, serviceName);
var instanceDelegate = namedDelegates.Search(key);
namedDelegates is an ImmutableHashTree<TKey, TValue>
, an internal class that implements (from its own comments):
/// A balanced binary search tree implemented as an AVL tree.
The reason I'm looking at LightInject is because of its excellent scores in Daniel Palme's IoC Performance Comparison and I'm puzzled as to why a O(log n) binary search algorithm is preferable to using a O(1) Dictionary in this case?
Can anyone educate me here?