Bug 42124 - DataTemplateSelector use causes major performance hit to ListView
Summary: DataTemplateSelector use causes major performance hit to ListView
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-06-23 17:35 UTC by Paul Mace
Modified: 2017-06-16 16:18 UTC (History)
7 users (show)

Is this bug a regression?: ---
Last known good build:

Sample project (238.98 KB, application/zip)
2017-06-16 16:17 UTC, James Montemagno [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Paul Mace 2016-06-23 17:35:18 UTC
Use Nish Anil's DataTemplateSelector sample.

The more messages you send, the slower the performance.  This appears to grow exponentially with list size.
Ass you add messages, each call to instantiate a new MessageViewModel gets progressively slower.
While this might stem from ListView.HasUnevenRows=true, that's what having the template selector is all about!

Comment 2 adrianknight89 2016-12-31 18:34:33 UTC
If this is a duplicate, can it be closed?
Comment 3 Samantha Houts [MSFT] 2017-01-03 01:42:02 UTC
It was marked in error.
Comment 4 James Montemagno [MSFT] 2017-06-16 16:17:43 UTC
Created attachment 22953 [details]
Sample project
Comment 5 James Montemagno [MSFT] 2017-06-16 16:18:37 UTC
Unfortunately, we’re unable to reproduce this report. If this issue is still occurring for you, please reopen this issue and attach a reproduction to the bug by starting with a clean Xamarin.Forms project adding just the code necessary to demonstrate the issue.

Here are some reproduction best practices: https://gist.github.com/jassmith/92405c300e54a01dcc6d

I have added my own test project against the latest versions and added a bunch of messages and didn't seem to have issues.