another day, another problem :) Since I woke up today I'm wondering about numbers. My experience does not allow me to answear my questions: What is the small collection? what is the medium size collection? what is the huge collection开发者_C百科? I mean where're the lines? ex. between 0 to XX elements is small collection and so on... I read many articles, blog posts about using collections and almost everywhere we can read "this solution is good for small collections" etc. and I ask: What does that mean? I know there's no hard lines but I think we can name it more or less :)
There are no hard lines, because it depends on many different things.
In some situations the size of the objects stored in the collection matter, in others it doesn't.
In some situations the CPU/memory is fast enough that "small" can be as large as a million, in others a few dozens is already "mid-sized".
Personally and from my experience in my specific field I'd guesstimate these rules-of-thumb:
- a small collections has at most 10-20 elements
- a few hundered elements make a medium-sized collection
- a collection with more than thousand elements is large-ish
Again: this is very subjective and situational.
Often "this works for small collections" is a synonym for "this has a non-linear runtime over the size of the collection" or (more specifically) "this is O(n^2)".
精彩评论