This commit is contained in:
邹晓航
2014-10-09 10:29:30 +08:00

View File

@@ -43,6 +43,8 @@ TinySTL
#TinySTL测试:
###测试环境Windows 7 && VS2013 && release模式
###测试结果:
####(1):
//std::vector<int> vec;
TinySTL::vector<int> vec;
ProfilerInstance::start();
@@ -56,6 +58,8 @@ TinySTL
######i = 100000 -> (TinySTL::vector<int>2ms \\ std::vector<int>6ms)
######i = 1000000 -> (TinySTL::vector<int>11ms \\ std::vector<int>16ms)
######i = 10000000 -> (TinySTL::vector<int>129ms \\ std::vector<int>210ms)
####(2):
//std::vector<std::string> vec;
TinySTL::vector<std::string> vec;
ProfilerInstance::start();
@@ -69,6 +73,8 @@ TinySTL
######i = 100000 -> (TinySTL::vector<int>18ms \\ std::vector<int>29ms)
######i = 1000000 -> (TinySTL::vector<int>181ms \\ std::vector<int>232ms)
######i = 10000000 -> (TinySTL::vector<int>2372ms \\ std::vector<int>1972ms)
####(3):
TinySTL::circular_buffer<int, 10000> cb(10000, 0);
//boost::circular_buffer<int> cb(10000, 0);
ProfilerInstance::start();
@@ -81,6 +87,23 @@ TinySTL
######i = 10000000 -> (TinySTL::circular_buffer75ms \\ boost::circular_buffer22ms)
######i = 100000000 -> (TinySTL::circular_buffer604ms \\ boost::circular_buffer252ms)
######i = 1000000000 -> (TinySTL::circular_buffer5936ms \\ boost::circular_buffer2241ms)
####(4):题目利用bitmap找出str中未出现的字母
std::string str("abcdefghijklmnpqrstuvwxyz");
TinySTL::bitmap<26> bm;
for (auto it = str.cbegin(); it != str.cend(); ++it){
bm.set(*it - 'a');
}
cout << bm << endl;
cout << bm.size() << endl;
for (int i = 0; i != 26; ++i){
if (!bm.test(i))
cout << "字母" << (char)('a' + i) << "没出现!!!" << endl;
}
输出结果:
111111111111110111111111111000000
32
字母o没出现