vpmalley / radiofeedz

rss reader refined for media
2 stars 0 forks source link

Feeds update is way too slow #7

Closed vpmalley closed 9 years ago

vpmalley commented 9 years ago

Currently the retrieval of feeds is very slow and it is growing with the number of sources (so the requests might not be parallelized).

vpmalley commented 9 years ago

Measurements

Following some perf measurements, it appears the times are as follows: network access : ~ 300 ms save to DB and refresh UI : ~ 1300 ms, up to 5s when adding the feed and previous feeds exist.

Also, there does not seem to be more than 2 threads used (at most the UI thread and one for network accesses).

Consequences

Therefore multiple things should be done:

vpmalley commented 9 years ago

The save to DB is now wrapped in asynchronous tasks, it is better. What made a difference is to reduce the workload for the UI thread, so saving to DB was a first step. A second step was to reduce the number of refreshes of the view were done, now with a hack only one is done, no matter the number of feeds added.

A third step, to do, is to reduce even more the workload on the UI thread by reading from the DB in an AsyncTask. It would put another second off the UI thread.

vpmalley commented 9 years ago

moved the load from DB to an async task. The UI now looks good enough.