Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 21560d80 authored by Roman Birg's avatar Roman Birg
Browse files

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: default avatarRoman Birg <roman@cyngn.com>
parent bd79d582
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment