vs2010的hash map速度还是比不上vc6+stl

[复制链接]
查看11 | 回复7 | 2012-5-21 10:19:41 | 显示全部楼层 |阅读模式
2010
D:\app>mc11 LT/LT query="select * from t" file=NUL
0,1 1,1 2,1 3,1 4,4
0 rows exported at 2010-04-20 14:04:44
recn=0
500000 rows exported at 2010-04-20 14:04:45
recn=500000
1000000 rows exported at 2010-04-20 14:04:46
output fileclosed at 1000000 rows.
sum=1545
sum(c1+c2+c3+v)=500111497488
sum(c4)=51690810
从数据库把表读入内存2156ms
4,5,67,114,152760
申请map内存0ms
申请一层内存31ms
新建一层hashmap节点953ms,recn=1000000,每毫秒读1049行,每毫秒写1049节点
申请后面内存63ms,1000000
realloc2000000
gid=1 found 0 time
新建后面节点[1],recn=2273836
新建后面节点[2],recn=2284894
新建后面节点[3],recn=2284894
新建后面节点[4],recn=2299600
新建后面节点[5],recn=2299600
新建后面节点[6],recn=2299600
新建后面节点2984ms,recn=2299600,每毫秒读335行key,每毫秒写435节点
malloc time=0ms
let time=15ms
Initializing the environment..
Logged on as LT
col0:c1 3 1
col1:c2 3 1
col2:c3 3 1
col3:c4 3 1
col4:cv 3 4
col5:sv 3 8
col6:gid3 1
time=109ms
col_ary_rows=4096,col_ary_cols=7
1000all time=4656ms
插入结果表1000000行
malloc time=0ms
let time=16ms
col0:c1 3 1
col1:c2 3 1
col2:c3 3 1
col3:c4 3 1
col4:cv 3 4
col5:sv 3 8
col6:gid3 1
time=16ms
col_ary_rows=4096,col_ary_cols=7
600all time=5578ms
插入结果表1299600行
释放所有动态内存15ms,2299600
释放所有map内存1000ms,2299600
总时间15312ms,2299600
3步(读入+运算+写出)总时间17484ms
Exiting with SUCCESS status 0
VC6+STL
D:\app>mc10LT/LT query="select * from t" file=NUL
0,1 1,1 2,1 3,1 4,4
0 rows exported at 2010-04-20 14:09:57
recn=0
500000 rows exported at 2010-04-20 14:09:58
recn=500000
1000000 rows exported at 2010-04-20 14:09:58
output fileclosed at 1000000 rows.
sum=1545
sum(c1+c2+c3+v)=500111497488
sum(c4)=51690810
从数据库把表读入内存1765ms
4,5,67,114,152760
申请map内存0ms
申请一层内存31ms
新建一层hashmap节点578ms,recn=1000000,每毫秒读1730行,每毫秒写1730节点
申请后面内存16ms,1000000
realloc2000000
gid=1 found 0 time
新建后面节点[1],recn=2273836
新建后面节点[2],recn=2284894
新建后面节点[3],recn=2284894
新建后面节点[4],recn=2299600
新建后面节点[5],recn=2299600
新建后面节点[6],recn=2299600
新建后面节点1578ms,recn=2299600,每毫秒读633行key,每毫秒写823节点
malloc time=0ms
let time=16ms
Initializing the environment..
Logged on as LT
col0:c1 3 1
col1:c2 3 1
col2:c3 3 1
col3:c4 3 1
col4:cv 3 4
col5:sv 3 8
col6:gid3 1
time=94ms
col_ary_rows=4096,col_ary_cols=7
1000all time=4250ms
插入结果表1000000行
malloc time=0ms
let time=0ms
col0:c1 3 1
col1:c2 3 1
col2:c3 3 1
col3:c4 3 1
col4:cv 3 4
col5:sv 3 8
col6:gid3 1
time=15ms
col_ary_rows=4096,col_ary_cols=7
600all time=5484ms
插入结果表1299600行
释放所有动态内存15ms,2299600
释放所有map内存250ms,2299600
总时间12250ms,2299600
3步(读入+运算+写出)总时间14062ms
Exiting with SUCCESS status 0
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
2010都用上了 很新潮啊

现在能XX了吗
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
看来ms的实现不如stl
参考
http://www.itpub.net/thread-1294185-1-1.html
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
and
http://blog.csdn.net/fullsail/archive/2009/06/01/4230312.aspx
http://blog.csdn.net/fullsail/archive/2009/12/21/5045355.aspx
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
2010与stlport也不兼容
D:\app>cl/O2 /EHsc /I d:\stlport\stlport /MT mc10.cpp /link oci.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.All rights reserved.
mc10.cpp
d:\stlport\stlport\stl/_cstdlib.h(158) : error C2084: function '__int64 abs(__int64)' already has a body
E:\VC2010\include\../include/stdlib.h(471) : see previous definition of 'abs'
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
VC2003 可以编译,连接需要.lib
D:\lt\dl>cl /O2 /I stlport\stlport /EHsc mapc6i8.cpp /link oci.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
mapc6i8.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation.All rights reserved.
/out:mapc6i8.exe
oci.lib
mapc6i8.obj
LINK : fatal error LNK1104: cannot open file 'stlport_static.lib'
D:\lt\dl>cl /O2 /I stl /EHsc mapc6i8.cpp /link oci.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
mapc6i8.cpp
stl\stl_algobase.h(57) : fatal error C1083: Cannot open include file: 'iostream.
h': No such file or directory
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
是不是发错地方了?
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
我还是比较喜欢stl
boost库好像也不错
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行