WP SilverLight 8.1 vs WP 8.1 (XAML) pros and cons

筅森魡賤 提交于 2019-12-18 12:18:22

问题


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


回答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.



来源:https://stackoverflow.com/questions/25603829/wp-silverlight-8-1-vs-wp-8-1-xaml-pros-and-cons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!