471,319 Members | 3,224 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Generic Collections vs ArrayList

I read an article sometime in the last few weeks comparing the performance of
Generic Collections to ArrayList. It was pretty detailed with several charts
comparing various collections methods between the two.

I think the article was in MSDN magazine but I can't find it after hours of
searching online.

Does anyone remember the article? If so, would you please send a link?

Thanks,
--
Dale Preston
MCAD C#
MCSE, MCDBA
Jan 27 '06 #1
5 7538
> I read an article sometime in the last few weeks comparing the
performance of Generic Collections to ArrayList. It was pretty
detailed with several charts comparing various collections methods
between the two.


Sahil Malik had a blog post with some comparisons nearly a year ago (http://codebetter.com/blogs/sahil.ma...02/40506.aspx).
I took that post and created a sample which extended it slightly. You can
download my sample at http://www.avbsg.net/Uploads/GenericPerformance.zip.

In short, the main performance issue with the ArrayList is the performance
hit you take when casting the object as you are getting the object back out
of the list.

Jim Wooley
Jan 27 '06 #2
"=?Utf-8?B?RGFsZQ==?=" <da******@nospam.nospam> wrote in
news:6B**********************************@microsof t.com:
I read an article sometime in the last few weeks comparing the
performance of Generic Collections to ArrayList. It was pretty
detailed with several charts comparing various collections
methods between the two.

I think the article was in MSDN magazine but I can't find it
after hours of searching online.

Does anyone remember the article? If so, would you please send
a link?

Thanks,


Dale,

This one?

http://msdn.microsoft.com/vcsharp/de...t/default.aspx

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jan 27 '06 #3
I think that was the one. Thanks. I guess my memory was playing tricks on
me; the only graph was about string concatenation vs StringBuilder. That
must have stuck because that's another favorite area of controversy for me:
the over use of StringBuilder when in fact, string concatenation can be
faster if the concatenation is done in one command.

But back to Generic Collections. Thanks for the link. What I'm hoping for
is to get the code for that test and run the test against a custom collection
derived from CollectionBase. ArrayLists are just about the worst case
comparison and, since I recommend creating CollectionBase based collections
to replace almost all arrays of objects, that comparison would offer more
realism.

What do you think?

--
Dale Preston
MCAD C#
MCSE, MCDBA
"Chris R. Timmons" wrote:
"=?Utf-8?B?RGFsZQ==?=" <da******@nospam.nospam> wrote in
news:6B**********************************@microsof t.com:
I read an article sometime in the last few weeks comparing the
performance of Generic Collections to ArrayList. It was pretty
detailed with several charts comparing various collections
methods between the two.

I think the article was in MSDN magazine but I can't find it
after hours of searching online.

Does anyone remember the article? If so, would you please send
a link?

Thanks,


Dale,

This one?

http://msdn.microsoft.com/vcsharp/de...t/default.aspx

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Jan 27 '06 #4
Interesting article and project. The results are even better than I would
have expected but they still don't compare collections. Any plans on
extending your project to an AnimalCollection inherited from CollectionBase
and doing a comparison against the generic collection classes?

--
Dale Preston
MCAD C#
MCSE, MCDBA
"Jim Wooley" wrote:
I read an article sometime in the last few weeks comparing the
performance of Generic Collections to ArrayList. It was pretty
detailed with several charts comparing various collections methods
between the two.


Sahil Malik had a blog post with some comparisons nearly a year ago (http://codebetter.com/blogs/sahil.ma...02/40506.aspx).
I took that post and created a sample which extended it slightly. You can
download my sample at http://www.avbsg.net/Uploads/GenericPerformance.zip.

In short, the main performance issue with the ArrayList is the performance
hit you take when casting the object as you are getting the object back out
of the list.

Jim Wooley

Jan 27 '06 #5
"=?Utf-8?B?RGFsZQ==?=" <da******@nospam.nospam> wrote in
news:68**********************************@microsof t.com:
I think that was the one. Thanks. I guess my memory was
playing tricks on me; the only graph was about string
concatenation vs StringBuilder. That must have stuck because
that's another favorite area of controversy for me: the over
use of StringBuilder when in fact, string concatenation can be
faster if the concatenation is done in one command.

But back to Generic Collections. Thanks for the link. What I'm
hoping for is to get the code for that test and run the test
against a custom collection derived from CollectionBase.
ArrayLists are just about the worst case comparison and, since I
recommend creating CollectionBase based collections to replace
almost all arrays of objects, that comparison would offer more
realism.

What do you think?


Click on the link in the article labeled "Figure 3". I think that
may be the graph you're thinking of.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jan 27 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by jonathan | last post: by
2 posts views Thread by ljlevend | last post: by
3 posts views Thread by KH | last post: by
4 posts views Thread by Adam Clauss | last post: by
3 posts views Thread by BombDrop | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.