On Nov 24, 11:44 am, Lew <[email protected]> wrote: > Bret Foreman wrote: > > > If the OP is really concerned about performance he can create an array > > of objects and implement his own protocol for reusing them. Then after > > the initial creation of the array, no objects need to be either > > created or destroyed. > > This might or might not have any effect on performance, much less a > noticeable one. > > The OP has shared no evidence that they have a performance problem, related > to GC or otherwise. > > There is no evidence that your approach would help, because changing the > lifetime of objects influences GC in sometimes unexpected ways.
Actually, I learned this approach from studying the Android internals, specifically the way the ListManager and ListAdapter work. I applied it to some code that I was using to manage a couple hundred objects and it worked like a champ. I did profile my code before and after, just as you are suggesting to the OP, and I saw a 10X improvement in that code section. You have a good point, though, without profiling first, you don't really know where the problem lies or how much a particular change has helped. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

