473,394 Members | 1,866 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,394 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 7635
> 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()'...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.