From f83e562d1dcd010938c2025068eb02e7653af2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Fri, 28 Nov 2014 16:04:01 +0800 Subject: [PATCH] Update README.md --- README.md | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a2aa06a..8c60760 100644 --- a/README.md +++ b/README.md @@ -216,26 +216,32 @@ TinySTL |std::priority_queue<int>|100万|92| |std::priority_queue<int>|1000万|1214| -####(7):binary_search_tree<int> +####(7):binary_search_tree<string> - TinySTL::binary_search_tree bst; - const size_t max = 10000; - std::random_device rd; + ifstream f; + char buff[256] = { 0 }; + std::string word; + f.open("C:\\Users\\zxh\\Desktop\\text.txt"); + TinySTL::vector v; + while (f.good()){ + f >> word; + std::copy(word.begin(), word.end(), buff); + v.push_back(TinySTL::string(buff, buff + word.size())); + } + TinySTL::binary_search_tree sbst; ProfilerInstance::start(); - size_t i = 0; - for (; i != max; ++i){ - bst.insert(rd()); - //rd(); + for (const auto& word : v){ + sbst.insert(word); } ProfilerInstance::finish(); ProfilerInstance::dumpDuringTime(); + f.close(); |container|quantity|time(ms)| |---------|--------|--------| -|TinySTL::binary_search_tree<int>|1万|1| -|TinySTL::binary_search_tree<int>|10万|21| -|TinySTL::binary_search_tree<int>|100万|347| -#######注:真实的插入时间 = 总的插入时间 - C++11随机数生成器生成随机数的总的时间 +|TinySTL::binary_search_tree<string>|44067|16| +|TinySTL::binary_search_tree<string>|169664|64| +|TinySTL::binary_search_tree<string>|438230|277| ####(8):deque<int>