开发者

Data model for a C# winform application

I'm writing a winform program with the following data model:

  • The data structure is described by a set of class and subclass
  • Once I store my data, I'm serializing开发者_运维问答 the class to an XML file.

When the software is running the data must be accessed very fast (the data model is accessed between 50 and 60 per second.

I plan to move the data storage from a XML file to an lite database.

My question is the following: is it realistic to use a database not only for storage, but also during the program execution? Will I face loss of performance?


If you don't need to update the data regularly, but just read from it, it would very probably be best to keep it in memory.

We know little about your app, so we cannot really give much better advice here. Maybe in your case it would be enough to just keep the XML in an XPathDocument structure, so that you can perform fast searches using XPath queries.

Another option could be, if your data is mostly key/value pairs, that you read the XML into a Dictionary and then search that Dictionary in your app.

But reading from a database, even a light one, will hardly be faster. The only counter-case I can think of is a read-optimized fast NoSQL-DB such as MongoDB. But even then my money would be on an in-memory data structure optimized for searching.


If you need to access it that fast, I don't think that a database is a good alternative. There will always be latency involved in a database call, even if it is on the same machine. It can probably work sometimes, but there will be higher latency on some occasions that you cannot control

I think that you should keep the data in memory to have fast enough access.

Why do you want to move away from XML? Do you have performance problems or other problems with the saving and loading of data?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜