Windows上最快的小型数据存储 [英] Fastest small datastore on Windows

查看:103
本文介绍了Windows上最快的小型数据存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程式会追踪大约1000个物件的状态。这些对象以没有特定顺序从持久存储器(串行化)读取和写入持久存储器。



现在应用程序使用注册表来存储每个对象的状态。这很不错,因为:




  • 很简单


  • 非常快


  • 单独对象的状态可以读取/写入,而不需要读取更大的实体(例如从大型XML文件中提取代码段)


  • 有一个像样的编辑器
    $ b

    说完之后,我想知道是否有更好的方法。 SQLite似乎是一个可能性,但你没有同一级别的多读者/多个作家,你得到与注册表,没有简单的方法来编辑现有的条目。



    有什么更好的建议吗?一堆平面文件?

    解决方案

    如果你开始尝试SQLite,你应该知道它可能不像你想要的那么快,但它可以通过应用一些成熟的优化提示快速做得更快:



    SQLite优化



    根据数据大小和可用RAM的数量,通过将sqlite设置为使用全内存数据库而不是写入磁盘,可以获得最佳的性能提升。



    对于内存数据库,传递NULL作为 sqlite3_open 确保TEMP_STORE已正确定义



    另一方面你告诉sqlite使用硬盘,那么你将获得与当前使用RegEdit类似的好处,以便即时操作程序的数据。



    可以模拟您当前的RegEdit技术与sqlite将是使用sqlite命令行工具连接到磁盘数据库。您可以在主程序运行时(和/或在暂停模式下暂停)在命令行上对sql数据运行UPDATE语句。


    My app keeps track of the state of about 1000 objects. Those objects are read from and written to a persistent store (serialized) in no particular order.

    Right now the app uses the registry to store each object's state. This is nice because:

    • It is simple

    • It is very fast

    • Individual object's state can be read/written without needing to read some larger entity (like pulling out a snippet from a large XML file)

    • There is a decent editor (RegEdit) which allow easily manipulating individual items

    Having said that, I'm wondering if there is a better way. SQLite seems like a possibility, but you don't have the same level of multiple-reader/multiple-writer that you get with the registry, and no simple way to edit existing entries.

    Any better suggestions? A bunch of flat files?

    解决方案

    If you do begin to experiment with SQLite, you should know that "out of the box" it might not seem as fast as you would like, but it can quickly be made to be much faster by applying some established optimization tips:

    SQLite optimization

    Depending on the size of the data and the amount of RAM available, one of the best performance gains will occur by setting sqlite to use an all-in-memory database rather than writing to disk.

    For in-memory databases, pass NULL as the filename argument to sqlite3_open and make sure that TEMP_STORE is defined appropriately

    On the other hand, if you tell sqlite to use the harddisk, then you will get a similar benefit to your current usage of RegEdit to manipulate the program's data "on the fly."

    The way you could simulate your current RegEdit technique with sqlite would be to use the sqlite command-line tool to connect to the on-disk database. You can run UPDATE statements on the sql data from the command-line while your main program is running (and/or while it is paused in break mode).

    这篇关于Windows上最快的小型数据存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆