Re: Xml Data Storage

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.

--
Dave Sexton

"Ciro" <ciro.ciro@xxxxxxxxx> wrote in message news:Xn_7h.48585$uv5.333904@xxxxxxxxxxxxxxxxxxxxx
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?





.



Relevant Pages

  • Re: writing at the end of the lines
    ... > Now due to the size of the arrays and the large number of time steps ... Memory tends to be ... the cost of programmer time. ... And if you can't store the whole file, ...
    (comp.lang.fortran)
  • Re: Store large number .
    ... The suugestion to use arrays is flawed since large arrays (for example, ... arrays) do not handle memory allocation well. ... The advantage of the string class is that stores only one byte for each char ... > store large number. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Is this a memory problem?
    ... Alternatively, split large arrays ... into multiple smaller ones. ... sets, is to store the data on disk, and load manageable chunks into ... memory for processing. ...
    (comp.os.linux.misc)
  • memory leak in (?)... (redux)
    ... the mem leaks in our long-running tcl daemons. ... when actively exercised the app grows continuously. ... the mystery is that while our audit code does show us a couple of arrays ... and memory are checked and meanwhile externally, ...
    (comp.lang.tcl)
  • Re: StackOverflowException.
    ... The Status object monitors the ... so I'm really at a total loss as to where I'm leaking stack memory. ... private static extern bool EscapeCommFunction(IntPtr hFile, ... Good to know about arrays. ...
    (microsoft.public.dotnet.framework)