JSON serialization performance issue on WP7

I have a .JSON file which is approx. 1.5 MB, containing about 1,500 JSON objects that I want to convert to domain objects when my application starts.

Currently, my process on the phone (and not on my development PC) takes about 23 seconds, which is too slow for me and forces me to write a list of objects to ApplicationSettings, so I do not need to do this every time the application is downloaded (only the first time) but even it takes 15 seconds to write and 16 seconds to read, all of which are not very good.

I didn't have much serialization, and I really don't know how to do it quickly.

I am currently using a namespace System.Runtime.Serializationwith DataContractand approach DataMember.

Any ideas on performance when loading this type?

+5
source share
6 answers

I found that the Json.NET library is more efficient and has better options that the standard json serializer has.

One performance issue that I encountered in my application was that my domain objects implemented INotifyPropertyChanged with code to support sending the event back to the UI thread. Since the deserialization code populated these properties, I did a lot of sorting the threads, which did not have to be there. Disabling notifications during deserialization significantly improves performance.

: Caliburn Micro, PropertyChangedBase, . :

[OnDeserializing]
public void OnDeserializing(StreamingContext context)
{
    IsNotifying = false;
}

[OnDeserialized]
public void OnDeserialized(StreamingContext context)
{
    IsNotifying = true;
}
+4

EQATEC Profiler WP7. - , , INotifyPropertyChanged .

+1

, . , / "" , , , .

, 1500 . 1500 , , , , - , 1500 . , , ? , , , ? , 2000 , 2000 . 2000 , / , , , .

. JSON .

+1

- . Json.Net.

+1

/ ApplicationSettings ( , Xml), , - , 16 , .

, , . , , . , , , , .

0

Have you tried several smaller files and serialized [de] in parallel to see if it would be faster?

0
source

All Articles