I store a list with about 3,000 objects in Isolatedstorage using Xml serialize. It will take too much time to deserialize it, and I was wondering if you have any recommendations for speeding it up.
Time is transferred to deserialize up to 500 objects, but permanently cancels 3000 deserialization. Will it take more time only on the emulator and will be faster on the phone?
I did a whole bunch of searches, and in some article it was said to use a binary stream, but I can not find it. I store in binary or xml does not matter, I just want to save the list.
I do not want to watch asynchronous loading yet ...
Check out the binary serializer that is part of sharpSerializer: http://www.sharpserializer.com/en/index.html
It is very easy and works quite well.
Here's a blog that talks about using it in WP7: http://www.eugenedotnet.com/2010/12/windows-phone-7-serialization-sharpserializer/
I use it like (consider this psuedocode and using the functions listed in eugenedotnet)
in App.xaml.cs:
Application_Dectivated() { IsolatedStorageFileStream stream = store.OpenFile(fileName, FileMode.OpenOrCreate); Serialize(stream,(obj)MyHugeList<myObject>); } Application_Activated() { IsolatedStorageFileStream stream = store.OpenFile(fileName, FileMode.Open); Deserialize(stream,(obj)MyHugeList<myObject>); }
Firstly, some good info here already, so +1 there.
I would recommend reviewing these articles, giving you a good perspective on the performance you can expect using a variety of box serialization methods.
Windows Phone 7 Serialization: Comparison | Eugenedotnet blog
WP7 serialization comparison
You can also consider using multiple files if you donβt need to download and write everything all in one place.
I would reiterate Jeff's recommendation that it would be a really good idea to get some significant work, which you will find after it, into the background thread so as not to impair user interaction.
This is pretty straight forward. Here's a walkthrough that I often recommend, and people find it concise and helpful.
PhαΊ‘m Tiα»u Giao - Themes in WP7
And also this, recently Sean Wildermouth, who also looks pretty good.
Sean Wildermouth - WP7 Architect - Part 9 of 10: Threading
For this many elements, you need to create an optimized serialization history. I see that many people use simple CSV and text formats for this.
Embedded serializers simply won't be fast enough.
You really should consider all this in the background thread for many reasons, although yes, you indicated that you did not want to do this.
Source: https://habr.com/ru/post/1335885/More articles:Unit testing with MVVM Light & DispatcherHelper - unit-testingWhat is the performance impact of using multisampled antialiasing on iOS? - iphoneIs the code compiled in an aspx page in a web application? - asp.netSQL queries in a loop - performanceCSS applies style to empty inputs ([value = '']) - cssHow can I use date format in YYYY-MM-DD format in asp classic? - asp-classicAdd new virtual hosts on Apache without restarting the server? - apacheHow to open my localhost for WWW? (Port Forwarding?) - apacheMEF WPF application with separate builds and download controls - c #Play MMS Stream with Clear HTML5 / JS - javascriptAll Articles