Closed Bug 735636 Opened 13 years ago Closed 13 years ago

PromptService list view has bad scroll performance

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox13 fixed, firefox14 fixed, blocking-fennec1.0 +)

VERIFIED FIXED
Firefox 14
Tracking Status
firefox13 --- fixed
firefox14 --- fixed
blocking-fennec1.0 --- +

People

(Reporter: lucasr, Assigned: lucasr)

References

Details

(Keywords: perf)

Attachments

(4 files, 4 obsolete files)

It should be using convertView correctly (avoids inflating every row) and using a viewholder pattern to avoid calling findViewById too often.
Keywords: perf
blocking-fennec1.0: --- → ?
How bad is scroll performance? How big of a list?
On the Asus Transformer TF101 tablet, I've seen it causing the "Appliction doesn not respond, close it?" dialog to appear, while scrolling in the select form helper popup on the testcase.
(In reply to Mark Finkle (:mfinkle) from comment #2) > How bad is scroll performance? How big of a list? It's not necessarily related to the size of the list. Basically, ListView recycles a lot of views while scrolling and the ListView adapter used in PromptService is not using the recycled view (aka convertView) and inflating rows on every getView() call. It should be straightforward to change PromptService to use convertView and ViewHolder pattern.
Assignee: nobody → lucasr.at.mozilla
blocking-fennec1.0: ? → +
Attachment #607945 - Flags: review?(wjohnston)
Attachment #607946 - Flags: review?(wjohnston)
Attachment #607947 - Flags: review?(wjohnston)
Comment on attachment 607945 [details] [diff] [review] (1/3) Correctly use recycled view and apply ViewHolder pattern Review of attachment 607945 [details] [diff] [review]: ----------------------------------------------------------------- Sounds like (from irc), we need to tweak this a bit. ::: mobile/android/base/PromptService.java @@ +490,5 @@ > + if (convertView == null) { > + int resourceId = mResourceId; > + if (item.isGroup) { > + resourceId = R.layout.list_item_header; > + } Docs say "Note: You should check that this view is non-null and of an appropriate type before using." How do we know whether the convertView we get is a header row or not? I guess we need to inform the Adapter of how many row types we have? I'll throw up a demo with a lot of rows including some header ones.
Attachment #607945 - Flags: review?(wjohnston) → review-
Attached file Test case
This is just a long multiple select list with header rows scattered throughout.
Comment on attachment 607947 [details] [diff] [review] (3/3) Factor out checked state update into separate method Review of attachment 607947 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/base/PromptService.java @@ +509,5 @@ > + private void maybeUpdateCheckedState(int position, PromptListItem item, TextView t) { > + if (item.isGroup) > + return; > + > + CheckedTextView ct = (CheckedTextView) t; I'm not sure all of these are checkedTextViews (i.e. context menus). Return if this is null, but I have a feeling it will actually throw instead and the gigantic try catch I had before was saving us, so we might be better to do a fancier check.... (I like instanceOf, but blassey tells me if you're using instanceOf, you're doing it wrong)
(In reply to Wesley Johnston (:wesj) from comment #10) > Comment on attachment 607947 [details] [diff] [review] > (3/3) Factor out checked state update into separate method > > Review of attachment 607947 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: mobile/android/base/PromptService.java > @@ +509,5 @@ > > + private void maybeUpdateCheckedState(int position, PromptListItem item, TextView t) { > > + if (item.isGroup) > > + return; > > + > > + CheckedTextView ct = (CheckedTextView) t; > > I'm not sure all of these are checkedTextViews (i.e. context menus). Return > if this is null, but I have a feeling it will actually throw instead and the > gigantic try catch I had before was saving us, so we might be better to do a > fancier check.... (I like instanceOf, but blassey tells me if you're using > instanceOf, you're doing it wrong) IIUC, the view will always be a CheckedTextView if it's not a group because we're using Android's select_dialog_multichoice and select_dialog_singlechoice layout.
Attachment #607945 - Attachment is obsolete: true
Attachment #607946 - Attachment is obsolete: true
Attachment #607946 - Flags: review?(wjohnston)
Attachment #610064 - Flags: review?(wjohnston)
Attachment #607947 - Attachment is obsolete: true
Attachment #607947 - Flags: review?(wjohnston)
Attachment #610062 - Flags: review?(wjohnston) → review+
Attachment #610063 - Flags: review?(wjohnston) → review+
Comment on attachment 610064 [details] [diff] [review] (3/3) Factor out checked state update into separate method Review of attachment 610064 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/base/PromptService.java @@ +530,5 @@ > + private void maybeUpdateCheckedState(int position, PromptListItem item, TextView t) { > + if (item.isGroup) > + return; > + > + CheckedTextView ct = (CheckedTextView) t; Context menus use android.R.layout.select_dialog_item which I don't think is a CheckedTextView.
Attachment #610064 - Flags: review?(wjohnston) → review-
Attachment #610064 - Attachment is obsolete: true
Attachment #610181 - Flags: review?(wjohnston) → review+
Make sure you've tested this with some different select type popups and context menus!
Comment on attachment 610062 [details] [diff] [review] (1/3) Correctly use recycled view and apply ViewHolder pattern Mobile only. Release blocker.
Attachment #610062 - Flags: approval-mozilla-aurora?
Comment on attachment 610063 [details] [diff] [review] (2/3) Factor out icon update into separate method Mobile only. Release blocker.
Attachment #610063 - Flags: approval-mozilla-aurora?
Comment on attachment 610181 [details] [diff] [review] Factor out checked state update into separate method Mobile only. Release blocker.
Attachment #610181 - Flags: approval-mozilla-aurora?
Regarding testcase http://people.mozilla.org/~mwargers/tests/forms/select/selectoptions_alot.html This seems definitely fixed to me in yesterday's trunk build on the Samsung Galaxy Nexus.
Status: RESOLVED → VERIFIED
Comment on attachment 610062 [details] [diff] [review] (1/3) Correctly use recycled view and apply ViewHolder pattern [Triage Comment] Mobile only & blocking Fennec 1.0. Approved for Aurora 13.
Attachment #610062 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #610063 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #610181 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: