XML/user data...

B

Brian H

Hi all,

I'd appreciate some feedback on persisting user-settings.

In my app, I have 3 different XML files that are used to persist data. I'm
going nuts to try and lower the load time in my app. Reading the XML files
are not TOO bad, but I've done a few very simple benchmarks to get an idea
as to where my bottleneck is (times are cumulative):

Constructor of main form: several seconds (inherent of .NET apps) +0
Initialize component, load several objects: +2
Load all XML files: +5
Process all settings, load off-screen graphics: +6
Form_Load called, several other objects instantiated including background
threads: +7

So this is bad -- 7 seconds until the Form_Load is complete from the time
the constructor is first hit. If I load the app continously (say, without a
reboot) I'll get a bit more favorable result:

Constructor of main form: several seconds (inherent of .NET apps) +0
Initialize component, load several objects: +2
Load all XML files: +4
Process all settings, load off-screen graphics: +5
Form_Load finished, several other objects instantiated including background
threads: +5

So on average, my app takes about 6 seconds after the constructor is hit. I
can shave about 1.5 seconds by lazy-loading a few of my heavier objects
which I'm already working on. Loading all the XML files takes just under 3
seconds on average, which is the biggest drain. I've tried reading the
data: 1) Using the XMLTextReader, 2) Using the DOM to navigate to the
settings, and 3) Loading the XML into a dataset.

Using the XMLTextReader is (IMO) the crudest method, but the fastest, with
times of 2.8 seconds, 3.8 seconds, and 4.5 seconds, respectively.

I'm not using many controls at all, it's clear my heavy objects and XML is
the burden. But what can I do about the XML load times? I'm open to any
suggestions -- moving to a lightweight database, for example....
suggestions?

Thanks,
Brian
 
I

Ilya Tumanov [MS]

Brian,

You can try loading XML on a separate thread, so UI will become responsive
faster.

On the other hand, 7 seconds is not bad at all.
You can easily mask it out by showing splash screen or a wait cursor.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
B

Brian H

Thanks Ilya,

I've thought about threading it out, but the problem is that much of the
user settings are defined in the XML file, such as color preferences,
fonts/sizes, etc. Some of it could be lazy-loaded, but the bulk of the
settings are needed before the app can "start." I've thought about and have
roughly tried lazy loading the settigns. I'd gain 2 seconds of speed, but
the app would "wobble" as the settings are loaded and the preferences are
set.

It's showing a wait cursor now -- I may change that to a splash screen, it
may appear to load quicker to see stuff zoom by on a splash screen rather
than the wait cursor...

Thank you for the response!
Brian

"Ilya Tumanov [MS]" said:
Brian,

You can try loading XML on a separate thread, so UI will become responsive
faster.

On the other hand, 7 seconds is not bad at all.
You can easily mask it out by showing splash screen or a wait cursor.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Brian H" <[email protected]>
Subject: XML/user data...
Date: Tue, 27 Apr 2004 21:33:04 -0700
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 1Cust241.tnt1.sandpoint.id.da.uu.net 65.239.23.241
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:51919
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Hi all,

I'd appreciate some feedback on persisting user-settings.

In my app, I have 3 different XML files that are used to persist data. I'm
going nuts to try and lower the load time in my app. Reading the XML files
are not TOO bad, but I've done a few very simple benchmarks to get an idea
as to where my bottleneck is (times are cumulative):

Constructor of main form: several seconds (inherent of .NET apps) +0
Initialize component, load several objects: +2
Load all XML files: +5
Process all settings, load off-screen graphics: +6
Form_Load called, several other objects instantiated including background
threads: +7

So this is bad -- 7 seconds until the Form_Load is complete from the time
the constructor is first hit. If I load the app continously (say, without a
reboot) I'll get a bit more favorable result:

Constructor of main form: several seconds (inherent of .NET apps) +0
Initialize component, load several objects: +2
Load all XML files: +4
Process all settings, load off-screen graphics: +5
Form_Load finished, several other objects instantiated including background
threads: +5

So on average, my app takes about 6 seconds after the constructor is
hit.
I
can shave about 1.5 seconds by lazy-loading a few of my heavier objects
which I'm already working on. Loading all the XML files takes just
under
3
seconds on average, which is the biggest drain. I've tried reading the
data: 1) Using the XMLTextReader, 2) Using the DOM to navigate to the
settings, and 3) Loading the XML into a dataset.

Using the XMLTextReader is (IMO) the crudest method, but the fastest, with
times of 2.8 seconds, 3.8 seconds, and 4.5 seconds, respectively.

I'm not using many controls at all, it's clear my heavy objects and XML is
the burden. But what can I do about the XML load times? I'm open to any
suggestions -- moving to a lightweight database, for example....
suggestions?

Thanks,
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top