-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Marshaler_Marshaling
Message 4 in Discussion

 
Hi Ashish, 
We say arraylist is fast, because in arraylist, we have pre-allocated memory 
space for objects. So when new objects are added to arraylist, they are just 
copied to this pre-allocated memory location. There is no allocation process 
going on for every object added to the arraylist. As said before default size 
of arraylist is 16. So if we are adding 12 new objects to the arraylist, it'll 
be fast operation because there will be no allocation of memory for these 12 
new objects.  
But if 20 objects are added to arraylist, then arraylist have to resize its 
capacity. By resizing, it have to create a new memory location for 32 objects 
as arraylist increases the size by multiple of 2. So here we get a performance 
hit. But now again if we were to add 10 more objects, it'll again just copy 
them to this allocated memory location. 
Hope this helps
-Rupreet 
http://marshaler.blogspot.com 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to