opensrp / opensrp-client-path

Other
6 stars 6 forks source link

Further improve app speed #130

Closed ekigamba closed 6 years ago

ekigamba commented 7 years ago

Responsive but slow child details page

ekigamba commented 7 years ago

Pages investigated so far:

  1. Child details Tabbed Page - ChildUnderFiveFragment

Other pages that use similar structures and would benefit:

  1. ChildImmunizationActivity

Views:

  1. ImmunizationRowGroup
  2. ImmunizationRowCard
  3. ImmunizationRowAdapter
  4. ServiceRowGroup
  5. ServiceRowAdapter
  6. ServiceRowCard

Issues found:

  1. ListView or related widgets do not reuse views
  2. Regex operations & String.replaceAll operations using 21% exclusive CPU time
  3. NestedScrollableView makes list view redundant
  4. ViewGroup.addView calls should be replaced with RecyclerView, ListView or any other appropriate list-like view with view reuse since widgets added are same type eg. ChildUnderFiveFragment@updateVaccinationViews, ChildUnderFiveFragment@updateServiceViews

Location of expensive Regex & replaceAll operations (opensrp-immunization module):

  1. VaccinatorUtils@generateScheduleList (String, org.joda.time.DateTime, Map<String, Date>, jList)
  2. VaccinatorUtils@generateScheduleList (List, org.joda.time.DateTime, Map<String, Date>, List) -->
  3. VaccinatorUtils@createServiceMap

Probable fixes:

  1. Use of recyclerviews and/or Expandable list view which provides ability of reusing views in nested ListView - It is recommended to do away with the NestedListView
  2. Use faster libraries for Regex & String operations - Guava, Apache Commons Lang & Custom Java Algorithms. These libraries are faster for some operations and not all in comparison to standard java API provided for the same.
  3. Reduce for loops & Db updates/RowGroup updates performed for each vaccine rendered

NB:

  1. ExpandableListView might be a bit laggy when all groups are expanded even those not visible on the list
  2. The fixes should be applied in the app implementing the view (opensrp-client-path) & the opensrp-immunization module**
mberg commented 7 years ago

Which views on the app do these apply to. Just the details page? Would be good to know what parts of the app the above affect. On Mon, Oct 23, 2017 at 7:40 AM ekigamba notifications@github.com wrote:

Issues found:

  1. ListView or related widgets do not reuse views
  2. Regex operations & String.replaceAll operations using 21% exclusive CPU time
  3. NestedScrollableView makes list view redundant

Probable fixes:

  1. Use of recyclerviews and/or Expandable list view which provides ability of reusing views in nested ListView - It is recommended to do away with the NestedListView
  2. Use faster libraries for Regex & String operations - Guava, Apache Commons Lang & Custom Java Algorithms. These libraries are faster for some operations and not all in comparison to standard java API provided for the same.
  3. Reduce for loops & Db updates/RowGroup updates performed for each vaccine rendered

NB: ExpandableListView might be a bit laggy when all groups are expanded even those not visible on the list

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenSRP/opensrp-client-path/issues/130#issuecomment-338631980, or mute the thread https://github.com/notifications/unsubscribe-auth/AADiQahwi_U9tXypqZFjCOARVh2RsTdWks5svHtFgaJpZM4P6ZZ1 .

ekigamba commented 7 years ago

Cool, will add that

cafootitt commented 6 years ago

This is done, closing.