Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
CnVCL 组件包
» 关于CnHashmap和CnHashTable性能问题?
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: 关于CnHashmap和CnHashTable性能问题?
myplxdm
新警察
UID 41810
Digest Posts 0
Credits 10
Posts 3
点点分 10
Reading Access 10
Registered 2009-2-17
Status Offline
#1
Post at 2009-6-16 10:33
Profile
|
Blog
|
P.M.
关于CnHashmap和CnHashTable性能问题?
我用TCnStrToPtrHashMap和TCnHashTableBig测试了一下,代码如下:
var
time,i:Cardinal;
hash:TCnStrToPtrHashMap;
begin
hash := TCnStrToPtrHashMap.Create();
time := GetTickCount;
for i := 0 to 9000000 do
begin
hash.Add(IntToStr(i),TObject(i));
end;
btn1.Caption := IntToStr(GetTickCount - time);
var
time,i:Cardinal;
hash:TCnHashTableBig;
begin
hash := TCnHashTableBig.Create(9000000 ); //如果我这个初始化9000000 就提示内存超出,小一点的数值是可以,不过好像最大就1百多万
time := GetTickCount;
for i := 0 to 9000000 do
begin
hash.put(IntToStr(i),TObject(i));
end;
btn1.Caption := IntToStr(GetTickCount - time);
以上的性能很差,不知道是不是我测试有问题,我用THashedStringList创建9000000 要70XX毫秒左右,但用上面的两个过了很久(20秒左右)都还没有执行完成,所以我中断了运行
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 12:24
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.007455 second(s), 9 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats