Update README.md
This commit is contained in:
30
README.md
30
README.md
@@ -216,26 +216,32 @@ TinySTL
|
|||||||
|std::priority_queue<int>|100万|92|
|
|std::priority_queue<int>|100万|92|
|
||||||
|std::priority_queue<int>|1000万|1214|
|
|std::priority_queue<int>|1000万|1214|
|
||||||
|
|
||||||
####(7):binary_search_tree<int>
|
####(7):binary_search_tree<string>
|
||||||
|
|
||||||
TinySTL::binary_search_tree<int> bst;
|
ifstream f;
|
||||||
const size_t max = 10000;
|
char buff[256] = { 0 };
|
||||||
std::random_device rd;
|
std::string word;
|
||||||
|
f.open("C:\\Users\\zxh\\Desktop\\text.txt");
|
||||||
|
TinySTL::vector<TinySTL::string> 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<TinySTL::string> sbst;
|
||||||
ProfilerInstance::start();
|
ProfilerInstance::start();
|
||||||
size_t i = 0;
|
for (const auto& word : v){
|
||||||
for (; i != max; ++i){
|
sbst.insert(word);
|
||||||
bst.insert(rd());
|
|
||||||
//rd();
|
|
||||||
}
|
}
|
||||||
ProfilerInstance::finish();
|
ProfilerInstance::finish();
|
||||||
ProfilerInstance::dumpDuringTime();
|
ProfilerInstance::dumpDuringTime();
|
||||||
|
f.close();
|
||||||
|
|
||||||
|container|quantity|time(ms)|
|
|container|quantity|time(ms)|
|
||||||
|---------|--------|--------|
|
|---------|--------|--------|
|
||||||
|TinySTL::binary_search_tree<int>|1万|1|
|
|TinySTL::binary_search_tree<string>|44067|16|
|
||||||
|TinySTL::binary_search_tree<int>|10万|21|
|
|TinySTL::binary_search_tree<string>|169664|64|
|
||||||
|TinySTL::binary_search_tree<int>|100万|347|
|
|TinySTL::binary_search_tree<string>|438230|277|
|
||||||
#######注:真实的插入时间 = 总的插入时间 - C++11随机数生成器生成随机数的总的时间
|
|
||||||
|
|
||||||
####(8):deque<int>
|
####(8):deque<int>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user