jeudi 28 mai 2015

Creating simple Object pool in Android

I've been reading many articles on how we can improve android app performance by reducing GC work of reclaiming unused object and heap thrashing. Now the question arises:

1) Is it possible to reduce the work done by GC ?

2) Some people say the DVM GC is so efficient that trying to “work around” its performance characteristics will just make things worse.

So, the "work around" could be creating Object Pool of fixed size where objects are pre-allocated when the pool is created. When application needs an object, it request from pool instead of creating one.

Then, I encountered a class in support.v4 library in android Pools.SynchronizedPool which I think can serve the purpose instead of the previous ObjectPool design pattern.

But, now how to use it in my simple android app just to test the performance.

Aucun commentaire:

Enregistrer un commentaire