This project has moved and is read-only. For the latest updates, please go here.

doing lots of saves is really slow

Feb 9, 2011 at 7:05 PM

I have a windows phone 7 app that reads several different books from xml files and allows the user to browse them. The problem with loading these books from xml every time is that it's slow and it makes it difficult to make changes to the xml files(to add marking, notes to chapters, ect.). So I decided to implement sterling (which I like a lot) so I could process the xml once, and save the data to a database. I parse the books into objects(volumes, books, chapters, ect.) and then save them to my sterling database. Processing the xml takes about 2 seconds, but if I save the data to sterling, it takes more than 10 minutes to process one book.

How can I speed this up or is there a different strategy I could use? Thanks for your help.

Feb 9, 2011 at 7:48 PM

Obviously performance is a concern and we are constantly tweaking/improving where we can. However, Isolated Storage simply has a limit to speed. Sterling is slower than direct serialization beacuse it has to parse properties/foreign/keys etc. but it is tough to say if that or just the speed of isolated storage itself is the limiting factor without understanding more.

The initial load is always going to take more time, the real power will be querying and pulling down or doing incremental updates.

One idea I've been working on a reference project is to write a project just to load the data, then call the database backup and save that stream. Then embed the stream and do a database restore the first time - I'm assuming this will be orders of magnitude faster than processing the XML directly and parsing out individual objects.

Feb 9, 2011 at 7:59 PM

Thanks for your quick response. I understand that saves are just inherently slow and it's not really a problem with sterling. Once all of the data was finally saved, it was quite fast to query for objects from the database.

I had an idea that is similar to what you recommended, but I'm not sure if it can be done.

I assume that Sterling is simply serializing objects and storing them in files in isolated storage. Is that correct?

If that is the case, couldn't I have another project do the loading/saving, and then ship the generated files with my app?

Feb 22, 2011 at 7:35 PM

Any update on that reference project?

Feb 22, 2011 at 8:13 PM

The desktop reference project does have this feature now, and it will work the same on the phone.