How does performance for reading/adding values from/to Dictionary(Of String, SomeReferenceType) depend on the number of records already entered? I mean, does time increase as O(1), O(log n), O(n) when n goes to be large, or in some other way?
Dim index As New Dictionary(Of String, SomeReferenceType)
' N entries added in a loop
' ...
Dim id As Integer = 123456789 ' 9-digit number
Dim key As String = id.ToString()
Dim value As New SomeReferenceType
index(key) = value ' Need to estimate this
value = index.TryGetValue(key) ' and this operations depending on N (for large N)
Also, what happens if there is lack of memory? Should we set capacity of dictionary before entering elements to avoid copying it in case there is not enough memory space? How long does this operation (copy dictionary to a new place if needed) take depending on N?