On Thu, Nov 24, 2011 at 2:44 PM, 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.  Even if the
> array approach did shave of a few milliseconds here or there, the added
> complexity of manually taking over memory management could create slowdowns
> and likely would create errors, and the effect on overall application
> performance would still be negligible.
> If the OP is really concerned about performance, and willing to behave like
> an intelligent person, he can *measure* the app's performance under
> realistic conditions, *profile* it and determine where the inefficient spots
> are *before* and *instead of* engaging cargo-cult superstitions about what
> will help.
> If you double the speed of something that only took 0.01% of overall
> execution time, but you have tripled the maintenance costs for the whole app
> and added new bugs that require new fixes, how is that a win?
> --
> Lew
>

But the whole point is moot:  the vm optimizes things beyond what you
would think.  If you want to know the optimizations that the vm makes,
you can read about it, and unless you do investigate it there's not
point in worrying about it.

(For example, the vm cuts out functions with no effects, think Object
constructor, does jit compilation, etc...)

So until you investigate the details, or have profiled and found a
problem, there's not really any point in worrying about it.

kris

-- 
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

Reply via email to