Update README.md

This commit is contained in:
邹晓航
2014-10-23 10:24:30 +08:00
parent b7643e8271
commit ad85be4d0c

View File

@@ -59,6 +59,7 @@ TinySTL
* priority_queue100%
* stack100%
* binary_search_tree100%
* deque100%
#TinySTL测试:
###测试环境Windows 7 && VS2013 && release模式
@@ -227,4 +228,30 @@ TinySTL
|TinySTL::binary_search_tree<int>|100万|828|
#######注:真实的插入时间 = 总的插入时间 - C++11随机数生成器生成随机数的总的时间
####(1):deque<int>
//std::deque<int> dq;
TinySTL::deque<int> dq;
ProfilerInstance::start();
const int max = 10000000;
int i = 0;
for (; i != max / 2; ++i){
dq.push_front(i);
}
for (; i != max; ++i){
dq.push_back(i);
}
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::deque&lt;int>|10万|15|
|TinySTL::deque&lt;int>|100万|78|
|TinySTL::deque&lt;int>|1000万|1186|
|std::deque&lt;int>|10万|90|
|std::deque&lt;int>|100万|1087|
|std::deque&lt;int>|1000万|4835|
#####ps这个性能差距的原因1是内部实现的机制不同我的deque是预先分配内存因此相同条件下占用的内存更多而stl的deque是需要的时候再分配更加节省内存2是stl的deque实现了更多更灵活的插入删除操作我只是实现了在头尾的插入和删除