项目中,需要对一大堆不断变化的数据,动态的更新和排序处理。
就想到用内存数据库。
比较了sqlite、h2、berkeley DB、fastdb、times ten、boost multi_index。
开始认为 速度上,应该是 boost multi_index > fastdb > berkeley DB > sqllite 和h2
实际上同一台机器,测试了 sqlite和boost multi_index,
100万条相同的简单数据分别插入
sqlite 是39微秒一条,boost multi_index 竟然要10毫秒,太让人意外了。怎么说sqlite有sql语句解析的开销,应该sqlite慢一些才合理。
这个结果然我百思不得其解,后来联系了boost开发组。
他们回信说,
I understand you're running your test program in debug mode.If so, invariant-checking mode and safe mode (enabledin your code by defining BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKINGand BOOST_MULTI_INDEX_ENABLE_SAFE_MODE), and in particularthe former, will greatly decrease performance. These aremeant to be used as debugging aids, not in productionmode. Please turn them off and recheck. Also, performanceshould be much better in release mode, both becauseit is release mode after all and because you're not definingthe aforementioned macros in that case.
他的意思是关掉2个宏,去掉安全模式和变量检查,速度就会快。
按他说的重新测试了一下,multi_index 速度为 22微秒一条。
这样的速度才对。
考虑到c++ stl 容器插入有变量拷贝的开销。
如果深度优化的话,极限速度在 10微秒左右,应该是可能的。
手头的应用,multi_index速度就足够。
顺便向大家推荐一下boost multi_index库,一个不错的便捷版本的内存数据库。
分享到:
相关推荐
boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_0.tar.zip boost_1_59_...
该资料为boost电路闭环控制的详细计算文档,文档用mathcad打开
C++ Boost程序库boost_1_35_0C++ Boost程序库boost_1_35_0C++ Boost程序库boost_1_35_0C++ Boost程序库boost_1_35_0C++ Boost程序库boost_1_35_0C++ Boost程序库boost_1_35_0C++ Boost程序库boost_1_35_0
boost_1_51库 , vc , dev c++ 开发环境编译通过 ...
Boost_ClosedLoop_boost控制_boost闭环_boost闭环_Boost_boost双闭环_源码.zip
Boost_ClosedLoop_boost控制_boost闭环_boost闭环_Boost_boost双闭环.zip
qt编译的boost_1_69库,希望能帮助大家,完成之后可以在刚才指定的目录中找到编译好的库。 引用的时候,第一步添加头文件目录 在项目文件*.pro中添加以下信息(如:I:\boost_1_69\bin\include\boost) INCLUDEPATH += F:/...
boost_1_70_0,可以提供智能指针等非常好用,含有编译方法,默认编译方法是配套VS2017。欢迎使用。
boost_1_74_0.tar.gz, boost c++库
boost_1_32_0库的安装包。这是比C++ STL还好的扩展库!
boost_1_78_0编译及使用,下载好的1.78以及编译说明文档。
用于mysql 5.7.27 源码编译,用到依赖包 boost_1_59_0.tar.gz
2、运行上面那个脚本之后,会有一个bjam.exe,运行,此时进行编译和安装,大概十几分钟左右 3、在工程中设置工程属性来使用boost库 ...工程属性----------链接器----------附加库目录:D:\boost_1_61_0\stage\lib
从官网下载的boost_1_73版本的boost,亲测安装可用。 安装方法: ./bootstrap.sh --prefix=/usr/local/boost ./b2 install 配置文件 vim /etc/profile export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/...
boost1 - 副本_boostdcdc_boost闭环_voltageregulation_Boost_boost升压_源码.rar
Boost是为C++语言标准库提供扩展的一些C++程序库的总称。Boost库是一个可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一,是为C++语言标准库提供扩展的一些C++程序库的总称。 Boost库由...
在 https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download 下载了好几个小时.. 解压为 boost_1_59_0.tar.gz 之后就可以用了
Boost_C++_库
Boost_Chopper
boost_1_75_0-msvc-14.1-64.exe.rar boost_1_75_0-msvc-14.1-64.exe.rar boost_1_75_0-msvc-14.1-64.exe.rar boost_1_75_0-msvc-14.1-64.exe.rar boost_1_75_0-msvc-14.1-64.exe.rar