15

I have been reading that Wp8.1 (XAML) apps are the new way of creating apps for Windows Phone 8.1, and the code is highly reusable for Windows 8.1 Desktop apps.

But im a bit worried since performing a single search from the Contacts (ContactManager in WP8.1 XAML) is way slower than the Silverlight counterpart.

Just returning all contacts from my Agenda (240 contacts with emails, thumbnails, etc...) takes 3 seconds in my Lumia 1520; the same operation with Silverlight code takes 0,7 seconds.

I am a bit afraid to use WP8.1 to makes apps for phone cause the performance is pretty important to me. The same test on a Lumia 535 takes 7 seconds and 1,5 seconds respectively with the contacts from my Lumia 1520.

Is there any recomendation on what kind of project to use? I feel Silverlight apps are (obviously) focused in Windows Phone and use all the phone's capabilities.

I am wrong? Am I heading into a deprecation road by picking windows phone silverlight?

Note: The code used to perform the search is the one from the MSDN Examples...

WP8.1 XAML (Nokia Lumia 1520, 3 seconds to get 240 contacts with thumbnails, mail accounts, etc...)

ContactStore agenda = await ContactManager.RequestStoreAsync();
Stopwatch sw = new Stopwatch();
IReadOnlyList<Windows.ApplicationModel.Contacts.Contact> contacts = null;
sw.Start();
contacts = await agenda.FindContactsAsync();
sw.Stop();
txtblock1.Text = sw.ElapsedMilliseconds;

WP Silverlight 8.1 (Nokia Lumia 1520, 0,7 seconds to get 240 contacts with thumbnails, mail accounts, etc...)

Contacts agenda = new Contacts();
//Stopwatch is declared at class level so its accessible in ListContacts_SearchCompleted Callback
sw.Start();
agenda.SearchCompleted+= ListContacts_SearchCompleted;
agenda.SearchAsync(String.Empty, FilterKind.None, null);
//sw.Stop() and print ElapsedMilliseconds in ListContacts_SearchCompleted callback

EDIT: Post created in forums regarding this https://social.msdn.microsoft.com/forums/windowsdesktop/en-us/1e0accaf-b2f8-4d68-b5ec-dc6af6351633/findcontactsasync-takes-long-time?referrer=http://social.msdn.microsoft.com/forums/windowsdesktop/en-us/1e0accaf-b2f8-4d68-b5ec-dc6af6351633/findcontactsasync-takes-long-time?referrer=http://social.msdn.microsoft.com/forums/windowsdesktop/en-us/1e0accaf-b2f8-4d68-b5ec-dc6af6351633/findcontactsasync-takes-long-time?forum=wpdevelop

asitis
  • 3,023
  • 1
  • 31
  • 55
Arys
  • 477
  • 3
  • 12
  • Are you running the Developer Preview or the actual released version/Cyan on the 1520 ? – Emond Sep 01 '14 at 10:38
  • Released version. Thing is that in all the devices i have tried, the code seems to need 4x the time to return the same query than the Silverlight counterpart. – Arys Sep 01 '14 at 11:06
  • @Arys How do you measure the time? When you start/stop measuring? Is the data dispalyed in some kind list? – Romasz Sep 01 '14 at 11:29
  • @Romasz i edited the question to show how I measure time. I have code to loop thru the returned contacts too, but the amount of time to loop thru them varies from aprox 4ms(XAML) and 16ms(Silverlight) – Arys Sep 01 '14 at 11:35
  • Is this an adequate question for Stackoverflow? These are matters of preference and choice. – Paulo Neves Sep 01 '14 at 14:19
  • @aiwarrior Maybe it is not in terms of choice, but the performance part i think its worth having a look. – Arys Sep 01 '14 at 14:45
  • @Arys have you got any updates on this topic? I am also facing a serious delay while getting the contacts in windows phone 8.1 xaml application. – asitis Dec 22 '14 at 06:57
  • @Arys Hi I posted a suggestion related this question in the dev forum. Please vote for it to happen. https://wpdev.uservoice.com/forums/110705-dev-platform/suggestions/7084736-contact-manager-api-need-performance-optimizatio – asitis Feb 12 '15 at 05:00
  • 1
    @asitis Great post mate. Commented it and also added info about other issue I encountered... – Arys Feb 12 '15 at 09:12

1 Answers1

1

Are you comparing the same thing?

In the Silverlight version, you can only call sw.Stop in completion handler.

If you really want to do a good comparison, you should get an ETW trace; then you can really understand what's going up.

For Metro XAML based solution, there may be extra interop cost. But that seems to be the future path.

For Silverlight, existing API may be more polished for perf.

May be you should work on both solutions, make shareable code as big as possible, and later decide which way to take.

  • I was comparing the same, and yes was stopping the stopwatch in the completion handler. I have seen an improvement in performance for XAML version with newer OS builds. Will write findings once i have more data and compare performance again. – Arys Sep 29 '14 at 10:30
  • Sorry for the late reply. I have tested and compared using different Windows Phone 8.1 builds and for the time being, the access to contacts is way slower in XAML than Silverlight project. – Arys Oct 30 '14 at 17:33
  • @Arys have you got any updates on this topic? I am also facing a serious delay while getting the contacts in windows phone 8.1 xaml application. – asitis Dec 22 '14 at 06:55
  • @asitis Nope. No word from Microsoft yet. Suppose it will be fixed with Windows 10... But so far the only thing we can do is to workaround the delay. – Arys Dec 22 '14 at 14:57
  • @Arys workaround the delay ? What it means since i need to get all contacts to proceed. – asitis Dec 24 '14 at 10:59
  • @asitis There is none at the moment. I tried with parallelism fetching from agenda by each letter but in the best of the cases it takes the same amount of time. – Arys Jan 19 '15 at 15:51