0

I'm using WinForms and C# for my application and my data is mainly some strings, integers and many lists. Now I store them in xml and text files but I just found out that reading the data takes too long. I'm using XmlWriter and XmlReader. For example I have 4 xml files totalling 2-3 mbs which I parse and ~250 text which I read their contents all at once. The loading takes 3-4 minutes and I'm not using threads. Is this normal or is something else going on? Should I use some other way to store my data? Does it have to do that I only use one thread?

EDIT I found the problem. It had nothing to do with the reading (I think). Anyway though, assuming the my data won't get more than a couple of MBs, should I use a database or I'm fine with xml?

Community
  • 1
  • 1
user579674
  • 2,159
  • 6
  • 30
  • 40
  • 1
    It shouldn't take that long, you're probably doing something wrong... please post your code – Thomas Levesque May 01 '11 at 21:44
  • In regards to your edit: If this is a "one off" and you are done with it you might as well stick with your xml file, but if you want to expand and develop this application in the future you should go forward with a redesign and use the DB. This will also force you to think more in terms of *what* data you really need when and how to structure it the right way. – BrokenGlass May 01 '11 at 23:24

1 Answers1

0

You are probably mostly I/O bound on this, so parallelizing will not help much - but it certainly should not take 3 to 4 minutes (more like 3 to 4 seconds) - something else is going on.

If you have large structured data, you should consider a database instead - then you can query for the data you need instead of having to load up everything at once. I.e. SQL Server Compact has a very small footprint for use in desktop applications.

BrokenGlass
  • 158,293
  • 28
  • 286
  • 335