This is a migrated thread and some comments may be shown as answers.

Slow Perfomance in Windows Phone Application Analysis

3 Answers 42 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alessandro
Top achievements
Rank 2
Alessandro asked on 08 Feb 2014, 12:29 PM
Hi!
I hope you'll make me clear why  Windows Phone Application Analysis indicates that there's a slow performance (High CPU usage) in my application and also with a standard Telerik Windows Phone app created from scratch with some semple pages as gallery etc..

I'm using my Nokia Lumia 920 and Lumia 925 to directly test any app and sometimes the indicators are green (zero alerts) and sometimes are red (indicating slow performance etc). This is happening especially after upgrading to latest build of Telerik UI controls.

So Yesterday I decided to use the emulator, the new Update3 emulator images, and there's no alerts at all!!!

To make things clear I'm referring to a simple Telerik Windows Phone app (the same thing happens obviously on my larger app) which binds a List to a DataBoundListBox control.
I've also incapsulated the simple routine on a  " ThreadPool.QueueUserWorkItem " and " Deployment.Current.Dispatcher.BeginInvoke " in order to not overload UI thread.

So the real and very important question for me is:
when I want to test a Windows Phone Application with the Application Analysis tool, I have to use emulator to have a "no influenced and pure enviroment "?

As I said before the results from that tool are very different and this makes me crazy!

Thanks in advance

Alessandro


 


3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 10 Feb 2014, 12:39 PM
Hello Alessandro,

Thanks for writing.

Our suggestion is to always use a real device when testing. If the performance is good there, you should not worry about it. The performance analysis tools are helpful when you notice performance degradation on a real device and want to investigate when and why does it happen.

Hope this helps.

Regards,
Deyan
Telerik
If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
0
Alessandro
Top achievements
Rank 2
answered on 10 Feb 2014, 01:39 PM
Hi Deyan,

thank you for your reply ! :)

I too prefer to test on the real device so I'm sure 100% that my app works fine. What makes me crazy sometimes is that even some simple list binding cause the red alert of slow responsivness of the app!

So to make things clear, I'd like and I'd appreciate much if you can confirm:

1) a ViewModel public property of type ObservableCollection<T> which is binded against a DataBoundListBox ItemsSource doesn't need to have NotifyPropertyChanged in his "set clause". I know that ObservableCollection does handle notification itself but I confess that I need to use notifypropertychanged otherwise the bind does not happen (without error).
The solution seems to be to initialize the observablecollection in the ViewModel constructor and then add the items when needed / requested all without using NotifyPropertyChanged in the observablecollection itself (I know that all properties of the class object do need notificationpropertychanged).

2) It is good and wise to put modification of ObservableCollection inside the following code in order to avoid UI thread freeze and cross-thread exception
 
ThreadPool.QueueUserWorkItem(async(q) =>
{
    // here i load items from web in async / await           
    Deployment.Current.Dispatcher.BeginInvoke(() =>
    {
          //add the items to observablecollection in foreach
    });
});

If I follow these two steps the analysis tool reports No Errors and that the App is responsive.

Thank you in advance for all your support and suggestion you can give to me .

Alessandro


 


0
Accepted
Deyan
Telerik team
answered on 10 Feb 2014, 03:50 PM
Hello Alessandro,

1) Confirmed: unless you want to reset the whole collection, firing the PropertyChanged event on a ObservableCollection<T> property is not needed

2) Confirmed.

Let us know if you have additional questions.

Regards,
Deyan
Telerik
If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
Tags
DataBoundListBox
Asked by
Alessandro
Top achievements
Rank 2
Answers by
Deyan
Telerik team
Alessandro
Top achievements
Rank 2
Share this question
or