Array vs. ArrayList

  • Thread starter Thread starter Bob Rundle
  • Start date Start date
B

Bob Rundle

I'm trying to decide between using System.Array or a
System.Collections.ArrayList.

It turns out that both of these classes will support the functionality I
need: one-dimension, not inserting new elements or appending, etc.

Why would you chose one over the other? Will System.Array perform better
than ArrayList when accessing or coping elements?

Regards,
Bob Rundle
 
Hello Bob,

With Array, you will need to know the size in advance. With ArrayList, you
can just do: myArrayList.Add(item).

I would choose ArrayList, because of the more robust interface. Ultimately,
if you do need an Array, you can always do myArrayList.ToArray();
 
Right...more robust...I'm with you on that.

However I am concerned about performance. It seems to me that System.Array
would be lower level and therefore have better performance than ArrayList.
However this is just a guess and I will need to set up some perf tests to
find out. I was hoping someone could spare me the trouble.

Regards,
Bob Rundle
 
Well, an arraylist uses an array internally. So if you work on the basis that "a thing on a thing is always slower than a thing" then yes it will be slower, but for reference types I wouldn;t have thought that performance difference was a huge issue (although you will have to perform casting when the objects are retrieved).

Arrays are faster for value types as value types have to be boxed when they are added to the arraylist (I can't wait for the List<T> generic from version 2.0). So if you are storing value types and you know how big the collection is going to be before hand (before you need to allocate it not necessarily at design time) then use an array.

To be honest though, the main thing you get from an array with reference types is compile time type checking. The compiler will spot if you try to put something in there that is not of the correct type. So for me, arrays are cleaner and more efficient but lack flexibility. ArrayList is flexible, but that comes at a cost (although that cost is often worth it in the face of the extra flexibility you get).

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Right...more robust...I'm with you on that.

However I am concerned about performance. It seems to me that System.Array
would be lower level and therefore have better performance than ArrayList.
However this is just a guess and I will need to set up some perf tests to
find out. I was hoping someone could spare me the trouble.

Regards,
Bob Rundle
 
The expense is really in the re-allocation of more space if the default size
is too small (16 i think) for the arraylist. It is more efficient to
initialize the arraylist with a solid estimate of the max capacity. That
would effectively stifle re-allocations. Outside of that issue, the
performance difference for the two structures are usually negligible.
 
ArrayList have a more robust interface
.......what does it mean ?
ArrayList are built on top of Array...
personally I would choose aray in your case!
 
Well...I don't think the performance difference is negligible...I just ran a
simple fill test. The performance difference is quite large

ArrayList fill time = 00:00:23.3437500 (sec)
Array fill time = 00:00:01.6718750 (sec)
Press enter to exit.

Array is about 14x faster than ArrayList for this trival test.

static void Main(string[] args)
{
int size = 10000000;

// ArrayList vs. Array performance tests

DateTime t0 = DateTime.Now;
ArrayList list = new ArrayList();
list.Capacity = size;
for(int i = 0; i < size; i++)
{
list.Add(i);
}
list = null;
TimeSpan dt = DateTime.Now - t0;
Console.WriteLine("ArrayList fill time = " + dt.ToString() + " (sec)");
t0 = DateTime.Now;
int[] array = new int[size];
for(int i = 0; i < size; i++)
{
array = i;
}
dt = DateTime.Now - t0;
Console.WriteLine("Array fill time = " + dt.ToString() + " (sec)");
Console.WriteLine("Press enter to exit.\n");
Console.ReadLine();
}

Alvin Bruney said:
The expense is really in the re-allocation of more space if the default
size is too small (16 i think) for the arraylist. It is more efficient to
initialize the arraylist with a solid estimate of the max capacity. That
would effectively stifle re-allocations. Outside of that issue, the
performance difference for the two structures are usually negligible.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Bob Rundle said:
Right...more robust...I'm with you on that.

However I am concerned about performance. It seems to me that
System.Array would be lower level and therefore have better performance
than ArrayList. However this is just a guess and I will need to set up
some perf tests to find out. I was hoping someone could spare me the
trouble.

Regards,
Bob Rundle
 
I see significant flaws - granted that you probably don't have a testing
lab.
The reason I point them out is because your degree of accuracy (7 decimals)
is too significant and you haven't removed the timing flaws.

-You start testing a loop but you include the allocation time. The timer
needs to be around the loop proper.
-Is this debug mode? Debug mode cannot be used for any sort of reliable
timing.
-You have not cached the loop counter index. It skews the time to the high
end and is not constant for both loops, at least to the degree of
significance you have included in your result.
-Your stop time includes the timing of at least a subtraction operation to
find t0.

You will find that writing timed tests is a perfect science best left for
labs. I'm not discouraging you from measuring but you should be aware of
factors that skew
test results making them inaccurate at best. My point was that a second or
so time difference is really negligle on a system that isn't based on real
time - all things considered.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Bob Rundle said:
Well...I don't think the performance difference is negligible...I just ran
a simple fill test. The performance difference is quite large

ArrayList fill time = 00:00:23.3437500 (sec)
Array fill time = 00:00:01.6718750 (sec)
Press enter to exit.

Array is about 14x faster than ArrayList for this trival test.

static void Main(string[] args)
{
int size = 10000000;

// ArrayList vs. Array performance tests

DateTime t0 = DateTime.Now;
ArrayList list = new ArrayList();
list.Capacity = size;
for(int i = 0; i < size; i++)
{
list.Add(i);
}
list = null;
TimeSpan dt = DateTime.Now - t0;
Console.WriteLine("ArrayList fill time = " + dt.ToString() + " (sec)");
t0 = DateTime.Now;
int[] array = new int[size];
for(int i = 0; i < size; i++)
{
array = i;
}
dt = DateTime.Now - t0;
Console.WriteLine("Array fill time = " + dt.ToString() + " (sec)");
Console.WriteLine("Press enter to exit.\n");
Console.ReadLine();
}

Alvin Bruney said:
The expense is really in the re-allocation of more space if the default
size is too small (16 i think) for the arraylist. It is more efficient to
initialize the arraylist with a solid estimate of the max capacity. That
would effectively stifle re-allocations. Outside of that issue, the
performance difference for the two structures are usually negligible.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Bob Rundle said:
Right...more robust...I'm with you on that.

However I am concerned about performance. It seems to me that
System.Array would be lower level and therefore have better performance
than ArrayList. However this is just a guess and I will need to set up
some perf tests to find out. I was hoping someone could spare me the
trouble.

Regards,
Bob Rundle

Hello Bob,

With Array, you will need to know the size in advance. With ArrayList,
you can just do: myArrayList.Add(item).

I would choose ArrayList, because of the more robust interface.
Ultimately, if you do need an Array, you can always do
myArrayList.ToArray();

--
Matt Berther
http://www.mattberther.com

I'm trying to decide between using System.Array or a
System.Collections.ArrayList.

It turns out that both of these classes will support the functionality
I need: one-dimension, not inserting new elements or appending, etc.

Why would you chose one over the other? Will System.Array perform
better than ArrayList when accessing or coping elements?

Regards,
Bob Rundle
 
Yes...a couple of fair points there...I addressed those (in particular, I
was running in debug).

Now my results are...

ArrayList fill time = 00:00:03.2031250 (sec)
Array fill time = 00:00:00.1093750 (sec)
Press enter to exit.

Array fill is now 32x faster than ArrayList fill.

I believe this to be a reasonable good qualitative test that tells me to use
Array whenever I can. You are quite right that my test is not scientific,
however, I can't seem to find the research studies that compare ArrayList
to Array. I also don't know anyone at a testing lab that can help me out.
I need to write some code right now. Stuff that people tell you in the
newsgroup is often very good, but not consistently right.

Bob Rundle

Alvin Bruney said:
I see significant flaws - granted that you probably don't have a testing
lab.
The reason I point them out is because your degree of accuracy (7
decimals) is too significant and you haven't removed the timing flaws.

-You start testing a loop but you include the allocation time. The timer
needs to be around the loop proper.
-Is this debug mode? Debug mode cannot be used for any sort of reliable
timing.
-You have not cached the loop counter index. It skews the time to the high
end and is not constant for both loops, at least to the degree of
significance you have included in your result.
-Your stop time includes the timing of at least a subtraction operation to
find t0.

You will find that writing timed tests is a perfect science best left for
labs. I'm not discouraging you from measuring but you should be aware of
factors that skew
test results making them inaccurate at best. My point was that a second or
so time difference is really negligle on a system that isn't based on real
time - all things considered.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Bob Rundle said:
Well...I don't think the performance difference is negligible...I just
ran a simple fill test. The performance difference is quite large

ArrayList fill time = 00:00:23.3437500 (sec)
Array fill time = 00:00:01.6718750 (sec)
Press enter to exit.

Array is about 14x faster than ArrayList for this trival test.

static void Main(string[] args)
{
int size = 10000000;

// ArrayList vs. Array performance tests

DateTime t0 = DateTime.Now;
ArrayList list = new ArrayList();
list.Capacity = size;
for(int i = 0; i < size; i++)
{
list.Add(i);
}
list = null;
TimeSpan dt = DateTime.Now - t0;
Console.WriteLine("ArrayList fill time = " + dt.ToString() + " (sec)");
t0 = DateTime.Now;
int[] array = new int[size];
for(int i = 0; i < size; i++)
{
array = i;
}
dt = DateTime.Now - t0;
Console.WriteLine("Array fill time = " + dt.ToString() + " (sec)");
Console.WriteLine("Press enter to exit.\n");
Console.ReadLine();
}

Alvin Bruney said:
The expense is really in the re-allocation of more space if the default
size is too small (16 i think) for the arraylist. It is more efficient
to initialize the arraylist with a solid estimate of the max capacity.
That would effectively stifle re-allocations. Outside of that issue, the
performance difference for the two structures are usually negligible.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Right...more robust...I'm with you on that.

However I am concerned about performance. It seems to me that
System.Array would be lower level and therefore have better performance
than ArrayList. However this is just a guess and I will need to set up
some perf tests to find out. I was hoping someone could spare me the
trouble.

Regards,
Bob Rundle

Hello Bob,

With Array, you will need to know the size in advance. With ArrayList,
you can just do: myArrayList.Add(item).

I would choose ArrayList, because of the more robust interface.
Ultimately, if you do need an Array, you can always do
myArrayList.ToArray();

--
Matt Berther
http://www.mattberther.com

I'm trying to decide between using System.Array or a
System.Collections.ArrayList.

It turns out that both of these classes will support the
functionality
I need: one-dimension, not inserting new elements or appending, etc.

Why would you chose one over the other? Will System.Array perform
better than ArrayList when accessing or coping elements?

Regards,
Bob Rundle

 
Stuff that people tell you in the newsgroup is often very good, but not
consistently right.
Well said.

Nice results too.
I'm not sufficiently motivated enough to run the code or do my own tests.
I'll accept your results as gospel.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Bob Rundle said:
Yes...a couple of fair points there...I addressed those (in particular, I
was running in debug).

Now my results are...

ArrayList fill time = 00:00:03.2031250 (sec)
Array fill time = 00:00:00.1093750 (sec)
Press enter to exit.

Array fill is now 32x faster than ArrayList fill.

I believe this to be a reasonable good qualitative test that tells me to
use Array whenever I can. You are quite right that my test is not
scientific, however, I can't seem to find the research studies that
compare ArrayList to Array. I also don't know anyone at a testing lab
that can help me out. I need to write some code right now. Stuff that
people tell you in the newsgroup is often very good, but not consistently
right.

Bob Rundle

Alvin Bruney said:
I see significant flaws - granted that you probably don't have a testing
lab.
The reason I point them out is because your degree of accuracy (7
decimals) is too significant and you haven't removed the timing flaws.

-You start testing a loop but you include the allocation time. The timer
needs to be around the loop proper.
-Is this debug mode? Debug mode cannot be used for any sort of reliable
timing.
-You have not cached the loop counter index. It skews the time to the
high end and is not constant for both loops, at least to the degree of
significance you have included in your result.
-Your stop time includes the timing of at least a subtraction operation
to find t0.

You will find that writing timed tests is a perfect science best left for
labs. I'm not discouraging you from measuring but you should be aware of
factors that skew
test results making them inaccurate at best. My point was that a second
or so time difference is really negligle on a system that isn't based on
real time - all things considered.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Bob Rundle said:
Well...I don't think the performance difference is negligible...I just
ran a simple fill test. The performance difference is quite large

ArrayList fill time = 00:00:23.3437500 (sec)
Array fill time = 00:00:01.6718750 (sec)
Press enter to exit.

Array is about 14x faster than ArrayList for this trival test.

static void Main(string[] args)
{
int size = 10000000;

// ArrayList vs. Array performance tests

DateTime t0 = DateTime.Now;
ArrayList list = new ArrayList();
list.Capacity = size;
for(int i = 0; i < size; i++)
{
list.Add(i);
}
list = null;
TimeSpan dt = DateTime.Now - t0;
Console.WriteLine("ArrayList fill time = " + dt.ToString() + "
(sec)");
t0 = DateTime.Now;
int[] array = new int[size];
for(int i = 0; i < size; i++)
{
array = i;
}
dt = DateTime.Now - t0;
Console.WriteLine("Array fill time = " + dt.ToString() + " (sec)");
Console.WriteLine("Press enter to exit.\n");
Console.ReadLine();
}

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
The expense is really in the re-allocation of more space if the default
size is too small (16 i think) for the arraylist. It is more efficient
to initialize the arraylist with a solid estimate of the max capacity.
That would effectively stifle re-allocations. Outside of that issue,
the performance difference for the two structures are usually
negligible.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Right...more robust...I'm with you on that.

However I am concerned about performance. It seems to me that
System.Array would be lower level and therefore have better
performance than ArrayList. However this is just a guess and I will
need to set up some perf tests to find out. I was hoping someone
could spare me the trouble.

Regards,
Bob Rundle

Hello Bob,

With Array, you will need to know the size in advance. With
ArrayList, you can just do: myArrayList.Add(item).

I would choose ArrayList, because of the more robust interface.
Ultimately, if you do need an Array, you can always do
myArrayList.ToArray();

--
Matt Berther
http://www.mattberther.com

I'm trying to decide between using System.Array or a
System.Collections.ArrayList.

It turns out that both of these classes will support the
functionality
I need: one-dimension, not inserting new elements or appending,
etc.

Why would you chose one over the other? Will System.Array perform
better than ArrayList when accessing or coping elements?

Regards,
Bob Rundle


 
Another possibility is to inherit form CollectionBase and get the type
checking for the types you want to add to the collecting, as if you used
array, but with the flexibility similar to ArrayList.

Regards,
Carsten
 
Hi Alvin,
I see significant flaws - granted that you probably don't have a testing
lab.

LOL! He got a > 10x difference and you teach him to go for a
testing lab? You should better admit that you gave him the wrong
suggestion ;-)

bye
Rob
 
Bob Rundle said:
Yes...a couple of fair points there...I addressed those (in particular, I
was running in debug).

Now my results are...

ArrayList fill time = 00:00:03.2031250 (sec)
Array fill time = 00:00:00.1093750 (sec)
Press enter to exit.

Array fill is now 32x faster than ArrayList fill.

I believe this to be a reasonable good qualitative test that tells me to use
Array whenever I can. You are quite right that my test is not scientific,
however, I can't seem to find the research studies that compare ArrayList
to Array. I also don't know anyone at a testing lab that can help me out.
I need to write some code right now. Stuff that people tell you in the
newsgroup is often very good, but not consistently right.

You've missed another *huge* point though - you're boxing in the
ArrayList case but not in the array case. That's why specifically
talked about reference types.

Changing it to a string array, and using "" for every value, I get
results where ArrayList is less than twice as slow as the array - and
as on my box it only takes a couple of seconds to add 10 million
elements, I think it's unlikely that that will be the bottleneck in any
significant program.
 
Robert Jordan said:
LOL! He got a > 10x difference and you teach him to go for a
testing lab? You should better admit that you gave him the wrong
suggestion ;-)

Or maybe that his testing methodology was very badly flawed, as it was
comparing boxing+storing with just storing. Huge difference.
 
Hi Jon,
Or maybe that his testing methodology was very badly flawed, as it was
comparing boxing+storing with just storing. Huge difference.

Actually this was *your* (absolutely correct) suggestion.

bye
Rob
 
LOL! He got a > 10x difference and you teach him to go for aNot to make a mountain out of a mold hill but consider this:

Bob posted a 14X difference.
I ran the code on my monster pc - the posted code showed a 29X difference as
is. I set about tweaking the code to reduce that difference.
I accounted for loop caching and made the recommended changes. The
difference was 22X
I accounted for boxing types by passing string.emtpy to a string array as
Jon suggested. 26X difference (I'm headed in the wrong direction so i make
adjustments)
Pass "" to the array instead of string.Empty 6X difference - looking good
I switch the blocks of code making the arraylist execute first followed by
the array 4X (no idea why this is happening but i accept the results because
it is in the right direction)

That's why i recommended a lab. The shadey programmer with time on her hands
can work the numbers all day long to arrive at results that will justify the
conclusion.
I was unable to arrive at Jon's numbers of 2X but it is clear that if i had
spent some more time tweaking,
it would have been possible. I'm sure that developers with more skill than
I would be able to erase the difference
with carefully constructed code slanted in the direction of the arraylist.
I learned this hard lesson a few moons ago in here: Methadology is more
important than numbers.
 
Hello Carsten" cb_!_AT_!_it-practice__!.dk (Remove _ !),

CollectionBase uses ArrayList under the hood...
 
on the other hand your code show well the pitfall the average developer will
fall in!
use generic, it will be better!
\
Alvin Bruney said:
Not to make a mountain out of a mold hill but consider this:

Bob posted a 14X difference.
I ran the code on my monster pc - the posted code showed a 29X difference
as is. I set about tweaking the code to reduce that difference.
I accounted for loop caching and made the recommended changes. The
difference was 22X
I accounted for boxing types by passing string.emtpy to a string array as
Jon suggested. 26X difference (I'm headed in the wrong direction so i make
adjustments)
Pass "" to the array instead of string.Empty 6X difference - looking
good
I switch the blocks of code making the arraylist execute first followed by
the array 4X (no idea why this is happening but i accept the results
because it is in the right direction)

That's why i recommended a lab. The shadey programmer with time on her
hands can work the numbers all day long to arrive at results that will
justify the conclusion.
I was unable to arrive at Jon's numbers of 2X but it is clear that if i
had spent some more time tweaking,
it would have been possible. I'm sure that developers with more skill
than I would be able to erase the difference
with carefully constructed code slanted in the direction of the arraylist.
I learned this hard lesson a few moons ago in here: Methadology is more
important than numbers.


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Robert Jordan said:
Hi Jon,


Actually this was *your* (absolutely correct) suggestion.

bye
Rob
 
on the other hand your code show well the pitfall the average developer
will fall in!
use generic, it will be better!
true.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Lloyd Dupont said:
on the other hand your code show well the pitfall the average developer
will fall in!
use generic, it will be better!
\
Alvin Bruney said:
LOL! He got a > 10x difference and you teach him to go for a
testing lab? You should better admit that you gave him the wrong
suggestion ;-)
Not to make a mountain out of a mold hill but consider this:

Bob posted a 14X difference.
I ran the code on my monster pc - the posted code showed a 29X difference
as is. I set about tweaking the code to reduce that difference.
I accounted for loop caching and made the recommended changes. The
difference was 22X
I accounted for boxing types by passing string.emtpy to a string array as
Jon suggested. 26X difference (I'm headed in the wrong direction so i
make adjustments)
Pass "" to the array instead of string.Empty 6X difference - looking
good
I switch the blocks of code making the arraylist execute first followed
by the array 4X (no idea why this is happening but i accept the results
because it is in the right direction)

That's why i recommended a lab. The shadey programmer with time on her
hands can work the numbers all day long to arrive at results that will
justify the conclusion.
I was unable to arrive at Jon's numbers of 2X but it is clear that if i
had spent some more time tweaking,
it would have been possible. I'm sure that developers with more skill
than I would be able to erase the difference
with carefully constructed code slanted in the direction of the
arraylist.
I learned this hard lesson a few moons ago in here: Methadology is more
important than numbers.


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Robert Jordan said:
Hi Jon,


I see significant flaws - granted that you probably don't have a
testing lab.

LOL! He got a > 10x difference and you teach him to go for a
testing lab? You should better admit that you gave him the wrong
suggestion ;-)


Or maybe that his testing methodology was very badly flawed, as it was
comparing boxing+storing with just storing. Huge difference.

Actually this was *your* (absolutely correct) suggestion.

bye
Rob
 
Well, an arraylist uses an array internally. So if you work on the basis
that "a thing on a thing is always slower than a thing" then yes it
will be
slower, but for reference types I wouldn't have thought that
performance
difference was a huge issue (although you will have to perform casting
when
the objects are retrieved).
Arrays are faster for value types as value types have to be boxed when they
are added to the arraylist (I can't wait for the List<T> generic from
version
2.0). So if you are storing value types and you know how big the
collection is
going to be before hand (before you need to allocate it not
necessarily at
design time) then use an array.
To be honest though, the main thing you get from an array with
reference types is compile time type checking. The compiler will spot
if you try to put something in there that is not of the correct type.
So for me, arrays are cleaner and more efficient but lack flexibility.
ArrayList is flexible, but that comes at a cost (although that cost is
often worth it in the face of the extra flexibility you get).

This is one of the best reasons I've ever read for preferring one
structure over another when being able insert / add to the list of
items is not needed after initial allocation. The other reasons being
type safety (a big plus as it often saves you heaps of debugging time,
leading to cheaper applications) and not having to cast on retrieval
(which clutters up your code). These latter reasons will go away with
generic types in Whidbey, but Richard's reason will still stand.

I don't know if this is Bob's case, but in every shop I've worked in
there have been one or more programmers concerned about "efficiency".
Usually they made foolish design decisions in order to save a few
clock cycles in programs that were spending 99% of their time doing
other things. For example, one fellow used arrays instead of hash
tables (when hash tables were clearly superior) because arrays were
"more efficient" than dynamic memory structures... in a program that
then put together a huge SQL query and headed off to a database for
half an hour. The program was chock-a-block with awkward code that
achieved a run time of 30 minutes and 2 milliseconds instead of 30
minutes and 3 milliseconds. It was ridiculous.

If you are building software with hard real-time deadlines (telephone
switches, medical equipment, etc), or if you are doing hugely
CPU-intensive things (ray tracing, game programming, etc) then you
should be looking to lab reports for efficiency and speed of certain
constructs within .NET. (But then I have to ask why you're using a
language with a garbage collector for applications where every CPU
cycle counts.) Otherwise, you're much better off to write the program,
profile it, find the bottlenecks, and concentrate your efforts on
improving the speed of what you find.

Arrays are no doubt quicker than ArrayList, but the difference is
unlikely to be so great as to dwarf performance bottlenecks in other
parts of your program, unless, as I said, you're writing one of the
few kinds of apps that spends the bulk of its time in the CPU.
 
Back
Top