OSDN Git Service
CMFM: improved search performance
Search was usable with a small number of results, but when the result
list grows to something > 1000, it can get really laggy.
A few improvemnts:
- The adapter was chunking items and adding them in bulk to the adapter,
but it was doing all the work in the main thread. Now it will process
one item at a time, doing all the rough work in an AsyncTask, and
passing the final objects to the adapter.
- We don't need to do any chunking of items to add them, but sorting
the list as soon as they are added is expensive too, so re-use the
streaming mechanism that was used to add items in chunks, and just
sort the list during that time.
- Cache common variables to not look them up on every result
- Use a List instead of generating a new DataHolder array _every time_ a
new object was added. It would end up GCing thousands of items
every time a new result was added.
- Make the adapter be as simple as possible and just display DataHolder
objects so it doesn't have to do any processing.
Ref: QRDL-950
Change-Id: I17dd606246556cdf2701bbf2b06933f138588d74
Signed-off-by: Roman Birg <roman@cyngn.com>