Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
TinySTL
提交
eff34f36
T
TinySTL
项目概览
OpenDocCN
/
TinySTL
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TinySTL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eff34f36
编写于
10月 22, 2014
作者:
邹
邹晓航
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/zouxiaohang/TinySTL.git
上级
ae03cbec
d7123d18
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
56 addition
and
23 deletion
+56
-23
README.md
README.md
+56
-23
未找到文件。
README.md
浏览文件 @
eff34f36
TinySTL
=======
采用C++11实现一款简易的STL标准库,既是C++STL的一个子集
又是一个超集
采用C++11实现一款简易的STL标准库,既是C++STL的一个子集
(裁剪了一些容器和算法)又是一个超集(增加了一些容器和算法)
目的:练习数据结构与算法和C++ Template编程
...
...
@@ -75,24 +75,34 @@ TinySTL
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
######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)
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::vector
<
int>|10万|2|
|TinySTL::vector
<
int>|100万|11|
|TinySTL::vector
<
int>|1000万|129|
|std::vector
<
int>|10万|6|
|std::vector
<
int>|100万|16|
|std::vector
<
int>|1000万|210|
####(2):vector<string>
//std::vector<std::string> vec;
TinySTL::vector<std::string> vec;
ProfilerInstance::start();
int i = 0;
for (; i != 10000; ++i){
for (; i != 10000
0
; ++i){
vec.push_back(std::string("zouxiaohang"));
}
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
######i = 100000 -> (TinySTL::vector<string>:18ms \\ std::vector<string>:29ms)
######i = 1000000 -> (TinySTL::vector<string>:181ms \\ std::vector<string>:232ms)
######i = 10000000 -> (TinySTL::vector<string>:2372ms \\ std::vector<string>:1972ms)
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::vector
<
string>|10万|18|
|TinySTL::vector
<
string>|100万|181|
|TinySTL::vector
<
string>|1000万|2372|
|std::vector
<
string>|10万|29|
|std::vector
<
string>|100万|232|
|std::vector
<
string>|1000万|1972|
####(3):circular_buffer<int, N>
TinySTL::circular_buffer<int, 10000> cb(10000, 0);
...
...
@@ -104,9 +114,14 @@ TinySTL
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
######i = 10000000 -> (TinySTL::circular_buffer:75ms \\ boost::circular_buffer:22ms)
######i = 100000000 -> (TinySTL::circular_buffer:604ms \\ boost::circular_buffer:252ms)
######i = 1000000000 -> (TinySTL::circular_buffer:5936ms \\ boost::circular_buffer:2241ms)
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::circular_buffer|1000万|75|
|TinySTL::circular_buffer|10000万|604|
|TinySTL::circular_buffer|100000万|5936|
|boost::circular_buffer|1000万|22|
|boost::circular_buffer|10000万|252|
|boost::circular_buffer|100000万|2241|
####(4):题目:利用bitmap找出str中未出现的字母
std::string str("abcdefghijklmnpqrstuvwxyz");
...
...
@@ -138,9 +153,14 @@ TinySTL
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
######i = 1000000 -> (TinySTL::string:7ms \\ std::string:37ms)
######i = 10000000 -> (TinySTL::string:39ms \\ std::string:229ms)
######i = 100000000 -> (TinySTL::string:484ms \\ std::string:1965ms)
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::string|100万|7|
|TinySTL::string|1000万|39|
|TinySTL::string|10000万|484|
|std::string|100万|37|
|std::string|1000万|229|
|std::string|10000万|1965|
####(6):priority_queue<int>
...
...
@@ -154,9 +174,14 @@ TinySTL
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
######i = 100000 -> (TinySTL::priority_queue<int>:13ms \\ std::priority_queue<int>:12ms)
######i = 1000000 -> (TinySTL::priority_queue<int>:97ms \\ std::priority_queue<int>:67ms)
######i = 10000000 -> (TinySTL::priority_queue<int>:1032ms \\ std::priority_queue<int>:752ms)
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::priority_queue
<
int>|10万|13|
|TinySTL::priority_queue
<
int>|100万|97|
|TinySTL::priority_queue
<
int>|1000万|1032|
|std::priority_queue
<
int>|10万|12|
|std::priority_queue
<
int>|100万|67|
|std::priority_queue
<
int>|1000万|752|
TinySTL::vector<int> v;
int i = 0;
...
...
@@ -172,9 +197,14 @@ TinySTL
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
######i = 100000 -> (TinySTL::priority_queue<int>:19ms \\ std::priority_queue<int>:7ms)
######i = 1000000 -> (TinySTL::priority_queue<int>:137ms \\ std::priority_queue<int>:92ms)
######i = 10000000 -> (TinySTL::priority_queue<int>:1532ms \\ std::priority_queue<int>:1214ms)
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::priority_queue
<
int>|10万|19|
|TinySTL::priority_queue
<
int>|100万|137|
|TinySTL::priority_queue
<
int>|1000万|1532|
|std::priority_queue
<
int>|10万|7|
|std::priority_queue
<
int>|100万|92|
|std::priority_queue
<
int>|1000万|1214|
####(7):binary_search_tree<int>
...
...
@@ -190,8 +220,11 @@ TinySTL
ProfilerInstance::finish();
ProfilerInstance::dumpDuringTime();
######i = 10000 -> TinySTL::binary_search_tree<int>:5ms
######i = 100000 -> TinySTL::binary_search_tree<int>:64ms
######i = 1000000 -> TinySTL::binary_search_tree<int>:828ms
|container|quantity|time(ms)|
|---------|--------|--------|
|TinySTL::binary_search_tree
<
int>|1万|5|
|TinySTL::binary_search_tree
<
int>|10万|64|
|TinySTL::binary_search_tree
<
int>|100万|828|
#######注:真实的插入时间 = 总的插入时间 - C++11随机数生成器生成随机数的总的时间
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录