Xml Data Storage

C

Ciro

Hi Guys, I'm developing an application that sends ICMP echo requests (ping)
via the .net Ping Class. I've some informations related to the network such
as IP addresses,Urls,SiteNames and so stored in a xml file. I need to use
theese informations in my ping method. The ping method will ping the sites
and change the background color property of some shapes I've created.
In the first version of the application I created an Arraylist of all the
Shape Controls an some arrays to store IP Adresses and SiteNames.The arrays
was created at runtime just when the application was started.
So the method had just to iterate throw those arrays.

The question is: Do you think is better to read the values from the xml file
each time I call the ping method (say once per second) or should I retrieve
the values from the file and store them in a Array or Arraylist or whatever?
Which of the two is the better performing way? I guess if I create Arrays
I'll use much more memory but if have to read through the xml structure each
time this would be processor consuming. Is that right?
 
D

Dave Sexton

Hi,
Do you think is better to read the values from the xml file each time I call the ping method (say
once per second) or should I retrieve the values from the file and store them in a Array or
Arraylist or whatever?

That all depends on the number of elements.

If the number is quite large then you may want to cache portions in memory, but not the entire
thing. (i.e., run a timer to release memory that hasn't been used recently)

If the number is small then just store the contents in memory.

The distinction between large and small amounts depend on the capabilities and amount of memory of
the computers that will be running your application. If you know the capabilities ahead of time it
should make your decision much easier.
Which of the two is the better performing way?

Memory will perform much better.
I guess if I create Arrays I'll use much more memory but if have to read through the xml structure
each time this would be processor consuming. Is that right?

Yes, and not just the processor, but I/O as well; meaning that your HDD will be quite busy serving
up data for ping requests once per second. You could optimize this by pulling out only the
appropriate data each time without scanning or reading the entire document, but since it's XML that
will probably be very difficult for you.
 

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