(Delphi泛型库DGL 下载)
几个库DGL、STL(vc6)、STL(SGI)、DCL 、DeCal、EZDSL的容器性能对比测试
(2006.10.20 DGL Profiler
DGL添加红黑树,增加容器:_TMap\_TMultiMap\_TSet\_TMultiSet;
更新DeCal和EZDSL的Hash表测试,由于它们不支持动态调整大小所以造成以前的测试成绩不能反映真实情况;
测试Visite或Find的时候会同时测试读和写,如果不能写,就读两次
DGL和STL使用了相同的测试,测试数据集1000万个integer;选用integer能够更好地反映库的性能;
(某些Delphi库使用string的测试成绩来说自己的库比STL的快完全是误导,这完全是由string的不同实现导致的);
其他几个库的测试,如果库的性能比较差,就会采取减小测试数据集的办法来减少测试时间;
对于线性容器(vector\deque\list)的随机访问使用了1M个integer;
)
CPU: AMD Athlon(tm)64 3000+(1.81G)
DGL lib (Delphi7 Compile)========================================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
TVector 0.011 us 0.008 us 0.086 us 31400.000 us 75000.000 us
TDeque 0.009 us 0.012 us 0.219 us 100000.000 us 0.009 us
TList 0.048 us 0.017 us 8590.000 us 0.077 us 0.055 us
IVector 0.018 us 0.018 us 0.110 us 31200.000 us 75000.000 us
IDeque 0.014 us 0.019 us 0.235 us 103200.000 us 0.011 us
IList 0.073 us 0.022 us 8440.000 us 0.077 us 0.056 us
Container: Insert Find Next Visite
Map 0.384 us 3.383 us 0.070 us
MultiMap 0.388 us 3.706 us 0.097 us
Set 0.461 us 3.253 us 0.064 us
MultiSet 0.457 us 3.260 us 0.064 us
HashMap 0.288 us 0.857 us 0.048 us
HashMultiMap 0.296 us 0.961 us 0.067 us
HashSet 0.284 us 0.869 us 0.052 us
HashMultiSet 0.254 us 0.868 us 0.046 us
DGL lib (Turbo Delphi2006 Compile)========================================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
TVector 0.029 us 0.007 us 0.079 us 27600.000 us 66800.000 us
TDeque 0.007 us 0.009 us 0.234 us 113200.000 us 0.006 us
TList 0.029 us 0.015 us 8520.000 us 0.066 us 0.037 us
IVector 0.025 us 0.015 us 0.107 us 33000.000 us 79600.000 us
IDeque 0.010 us 0.015 us 0.245 us 103400.000 us 0.013 us
IList 0.050 us 0.017 us 8950.000 us 0.054 us 0.034 us
Container: Insert Find Next Visite
Map 0.370 us 3.592 us 0.075 us
MultiMap 0.388 us 3.873 us 0.104 us
Set 0.366 us 3.254 us 0.062 us
MultiSet 0.345 us 3.275 us 0.062 us
HashMap 0.292 us 0.832 us 0.039 us
HashMultiMap 0.275 us 0.898 us 0.060 us
HashSet 0.248 us 0.847 us 0.043 us
HashMultiSet 0.245 us 0.847 us 0.036 us
================================================================================
Delphi7=========================================================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
array 0.170 us 0.005 us 0.078 us 43800.000 us 121800.000 us
TList 0.023 us 0.013 us 0.125 us 25000.000 us 62400.000 us
================================================================================
STL (VC6 Compile)===============================================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
vector 0.041 us 0.005 us 0.078 us 31200 us 68800 us
deque 0.013 us 0.006 us 0.227 us 365600 us 0.012 us
list 0.169 us 0.022 us 21800 us 0.180 us 0.183 us
Container: Insert Find Next Visite
map 0.431 us 3.174 us 0.048 us
set 0.433 us 3.174 us 0.049 us
multimap 0.430 us 3.174 us 0.047 us
multiset 0.427 us 3.174 us 0.048 us
STL (VC2005 Compile)===============================================================
vector 0.019 us 0.009 us 0.078 us 62600 us 140600 us
deque 0.067 us 0.013 us 0.227 us 168800 us 0.061 us
list 0.269 us 0.017 us 15600 us 0.277 us 0.269 us
Container: Insert Find Next Visite
map 2.436 us 4.813 us 0.042 us
set 2.473 us 4.813 us 0.041 us
multimap 2.420 us 4.813 us 0.041 us
multiset 2.416 us 4.813 us 0.041 us
hash_map 0.888 us 1.501 us 0.207 us
hash_set 1.378 us 1.453 us 0.207 us
hash_multimap 1.373 us 1.450 us 0.207 us
hash_multiset 1.380 us 1.450 us 0.207 us
(SGI)STL (DEV-C++4.98 GCC max optimize Compile)=================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
vector 0.016 us 0.005 us 0.070 us 34400 us 62400 us
deque 0.011 us 0.009 us 0.258 us 865600 us 0.013 us
list 0.047 us 0.014 us 9400 us 0.052 us 0.036 us
Container: Insert Find Next Visite
map 0.538 us 3.226 us 0.033 us
set 0.516 us 3.226 us 0.034 us
multimap 0.492 us 3.174 us 0.038 us
multiset 0.495 us 3.994 us 0.039 us
hash_map 0.145 us 0.701 us 0.043 us
hash_set 0.234 us 0.650 us 0.044 us
hash_multimap 0.639 us 0.698 us 0.044 us
hash_multiset 0.138 us 0.650 us 0.043 us
================================================================================
DCL lib (Delphi7 Compile)=======================================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
TArrayList 0.013 us 0.030 us 0.157 us 25000.000 us 65600.000 us
TVector 0.013 us 0.027 us 0.172 us 28200.000 us 62600.000 us
TLinkedList 0.045 us 0.023 us 5780.000 us 0.052 us 0.081 us
Container: Insert Find Next Visite
TBinaryTree 0.473 us 1.125 us 0.086 us
THashMap 0.422 us 0.860 us 0.075 us(copy Values to TArrayList,it is not ture test!)
THashSet 0.500 us 0.780 us "Container.First" is O(N*N) is bad,can not test!
ps: THashXXX.Create()
for I := 0 to FCapacity - 1 do
SetLength(FBuckets[I].Entries, 64);) //is bad design, slow and waste memory!
ps: TLinkedList.Clear() ERROR !!!
procedure TLinkedList.Clear;
.....
//ERROR , must add line: FStart:=nil;
end;
================================================================================
DeCal lab (Delphi7 Compile)=====================================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
DArray 0.272 us 0.170 us 0.321 us 53000.000 us 125000.000 us
DList 0.238 us 0.106 us 13062.000 us 0.198 us 0.188 us
Container: Insert Find Next Visite
DSet 2.125 us 6.422 us 0.091 us
DMultiSet 2.055 us 5.688 us 0.086 us
DMap 1.993 us 4.921 us 0.081 us
DMultiMap 1.930 us 5.422 us 0.120 us
DHashSet 0.946 us 2.406 us 0.974 us
DMultiHashSet 0.836 us 2.407 us 0.977 us
DHashMap 1.164 us 2.266 us 0.987 us
DMultiHashMap 1.063 us 2.172 us 0.922 us
================================================================================
EZDSL lab (Delphi7 Compile)=====================================================
Container: PushBack Next Visite Random Visite Insert At Middle PushFront
(TEZCollection is maxsize is N=10922*92 for test! it is small for test.)
TEZCollection 0.078 us 0.077 us 4.667 us 0.388 us 0.588 us
TDList 0.175 us 0.039 us 6250.000 us 0.167 us 0.147 us
TLinkList 0.169 us 0.031 us 13300.000 us 0.180 us 0.159 us
Container: Push Pop
TQueue 0.141 us 0.150 us
TStack 0.144 us 0.147 us
Container: Insert Find Next Visite
THashTable 1.934 us 2.695 us (not find way to test!)
================================================================================