Performance of Arrays vs. Lists

Say you need to have a list/array of integers which you need iterate frequently, and I mean extremely often. The reasons may vary, but say it’s in the heart of the inner most loop of a high volume processing.

In general, one would opt for using Lists (List) due to their flexibility in size. On top of that, msdn documentation claims Lists use an array internally and should perform just as fast (a quick look with Reflector confirms this). Neverless, there is some overhead involved.

Did anyone actually measure this? would iterating 6M times through a list take the same time as an array would?

14 Answers
14

Leave a Comment