操作系統(tǒng): Windows11專(zhuān)業(yè)版
硬件環(huán)境:Intel i5-12500 3GHz 、16GB
IDE:VS2019
Release模式下:
查找效率:unordered_map ≈ hash_map >map
std::map 的效率遠(yuǎn)小于 unordered_map 和 hash_map
Debug模式下:
詳細(xì)數(shù)據(jù)見(jiàn)本文下方的 測(cè)試過(guò)程記錄
測(cè)試代碼#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include#include
測(cè)試過(guò)程記錄
測(cè)試版本 RLEASE x64第一次測(cè)試
test begin...
begin test, size:10 times:10000000
exit time_const:377538 microseconds test map
exit time_const:185946 microseconds test unordered_map
exit time_const:231577 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100 times:1000000
exit time_const:680158 microseconds test map
exit time_const:174351 microseconds test unordered_map
exit time_const:219366 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000 times:100000
exit time_const:2456112 microseconds test map
exit time_const:193982 microseconds test unordered_map
exit time_const:216137 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000 times:10000
exit time_const:3935452 microseconds test map
exit time_const:262153 microseconds test unordered_map
exit time_const:246536 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100000 times:1000
exit time_const:3874978 microseconds test map
exit time_const:451669 microseconds test unordered_map
exit time_const:397784 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000000 times:100
exit time_const:5637420 microseconds test map
exit time_const:2033308 microseconds test unordered_map
exit time_const:1697859 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000000 times:10
exit time_const:5980635 microseconds test map
exit time_const:2049441 microseconds test unordered_map
exit time_const:2335847 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
test finished
第二次測(cè)試
test begin...
begin test, size:10 times:10000000
exit time_const:387035 microseconds test map
exit time_const:194017 microseconds test unordered_map
exit time_const:219453 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100 times:1000000
exit time_const:658199 microseconds test map
exit time_const:178675 microseconds test unordered_map
exit time_const:219622 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000 times:100000
exit time_const:2367859 microseconds test map
exit time_const:186760 microseconds test unordered_map
exit time_const:229742 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000 times:10000
exit time_const:3969829 microseconds test map
exit time_const:258913 microseconds test unordered_map
exit time_const:254943 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100000 times:1000
exit time_const:3835890 microseconds test map
exit time_const:523620 microseconds test unordered_map
exit time_const:403951 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000000 times:100
exit time_const:5635731 microseconds test map
exit time_const:2144435 microseconds test unordered_map
exit time_const:1756355 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000000 times:10
exit time_const:6138499 microseconds test map
exit time_const:2386299 microseconds test unordered_map
exit time_const:2600038 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
test finished
第三次測(cè)試
test begin...
begin test, size:10 times:10000000
exit time_const:383793 microseconds test map
exit time_const:179461 microseconds test unordered_map
exit time_const:246965 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100 times:1000000
exit time_const:696714 microseconds test map
exit time_const:184956 microseconds test unordered_map
exit time_const:240162 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000 times:100000
exit time_const:2417398 microseconds test map
exit time_const:224808 microseconds test unordered_map
exit time_const:225643 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000 times:10000
exit time_const:4034813 microseconds test map
exit time_const:265107 microseconds test unordered_map
exit time_const:235180 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100000 times:1000
exit time_const:3983721 microseconds test map
exit time_const:593352 microseconds test unordered_map
exit time_const:478527 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000000 times:100
exit time_const:5755605 microseconds test map
exit time_const:2157740 microseconds test unordered_map
exit time_const:1781829 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000000 times:10
exit time_const:6350555 microseconds test map
exit time_const:2214270 microseconds test unordered_map
exit time_const:2407366 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
test finished
測(cè)試版本 Debug x64第一次測(cè)試
test begin...
begin test, size:10 times:10000000
exit time_const:77725513 microseconds test map
exit time_const:55867924 microseconds test unordered_map
exit time_const:50301682 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100 times:1000000
exit time_const:103791587 microseconds test map
exit time_const:57031541 microseconds test unordered_map
exit time_const:53823537 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000 times:100000
exit time_const:116249684 microseconds test map
exit time_const:55005075 microseconds test unordered_map
exit time_const:52733354 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000 times:10000
exit time_const:141760952 microseconds test map
exit time_const:60648988 microseconds test unordered_map
exit time_const:54216907 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:100000 times:1000
exit time_const:164759336 microseconds test map
exit time_const:75498544 microseconds test unordered_map
exit time_const:66905100 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:1000000 times:100
exit time_const:195118169 microseconds test map
exit time_const:76603801 microseconds test unordered_map
exit time_const:70866936 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
begin test, size:10000000 times:10
exit time_const:223320650 microseconds test map
exit time_const:77281447 microseconds test unordered_map
exit time_const:73711380 microseconds test hash_map
count_map:100000000 count_unordered_map:100000000 count_hash_map:100000000
test finished
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級(jí)服務(wù)器適合批量采購(gòu),新人活動(dòng)首月15元起,快前往官網(wǎng)查看詳情吧
名稱(chēng)欄目:C++stdmapunordered-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)網(wǎng)址:http://jinyejixie.com/article46/psgeg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈、用戶(hù)體驗(yàn)、做網(wǎng)站、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容