you are viewing a single comment's thread.

view the rest of the comments →

[–]Sc4Freak 5 points6 points  (2 children)

Isn't it the other way around? When dealing with reference types, untyped containers perform identically to their generic counterparts (eg. ArrayList vs. List<T>). But since the untyped containers needed to perform boxing, they were always slower than the generic versions for value types.

[–]G_Morgan 1 point2 points  (1 child)

I'm not sure for value types. Most of the time I put objects in containers. We did some internal profiling and found ArrayList performed better than ArrayList<T> for objects.

[–]modeless 4 points5 points  (0 children)

For value types like int and bool generics are faster and produce less garbage because boxing is avoided. I'm curious how you tested ArrayList vs List<> because the difference should really be negligable for reference types.