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>