473,231 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 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 7629
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jay Douglas | last post by:
I need help getting the collections to show up in the property window of a user control. I want to be able to edit the collection items just like any other asp.net control that has collection...
1
by: jonathan | last post by:
Hi I have a class that contains an array of another class: public abstract class Node {} public class elem1 : Node { public ArrayList NodeItems1=new ArrayList (); }
5
by: majm | last post by:
I'm trying to implement strongly typed lists in the 2.0 framework. I'm using VS2005 beta 2. So far, System.Collections.Generic.List appears to be the ideal solution. However, the...
5
by: cody | last post by:
I know I can use ArrayList.ReadOnly() to create a readonly version of it, but how can I achive a similar thing with a generic collection of .NET 2.0?
2
by: ljlevend | last post by:
I've noticed that in VS.NET 2.0 Beta 1 that none of the methods in System.Collections.Generic.List are overridable. In my app I currently have over 50 strongly typed ArrayLists that inherit from...
3
by: KH | last post by:
I can't seem to figure this one out... I've searched MSDN and Goog, and made my best guesses to no avail,, so help would be much appreciated! public ref class T sealed : public...
4
by: Adam Clauss | last post by:
I ran into a problem a while back when attempting to convert existing .NET 1.1 based code to .NET 2.0 using Generic collections rather than Hashtable, ArrayList, etc. I ran into an issue because...
3
by: BombDrop | last post by:
Can any one help I have a method that will return a List to be bound as a datasource to a combobox see code for population below. I get the following error when i try to compile Error 29 ...
8
by: Andrus | last post by:
Code below causes error in class definition line .....Isolator<T>' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'. 'Myapp.Isolator<T>.GetEnumerator()'...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.