gold_hash_map bench mark with google sparse hash

This is the testing result with google sparse hash's bench mark (time_hash_map.cc in google sparse hash's tar ball)

The only modify to time_hash_map.cc is added the test for gold_hash_map (see diff below)

87a88
> #include <febird/gold_hash_map.hpp>
172a174,178
> template<typename K, typename V, typename H>
> class EasyUse_gold_hash_map : public gold_hash_map<K,V,H> {
>  public:
>   void resize(size_t r) { this->rehash(r); }
> };
669a676,679
>     measure_map< EasyUse_gold_hash_map<ObjType, int, HashFn>,
>                  EasyUse_gold_hash_map<ObjType*, int, HashFn> >(
>         "gold_hash_map", obj_size, iters, stress_hash_function);
>

source: gold_hash_map.hpp

Here is the result!

======
Linux ubuntu 2.6.32-35-generic #78-Ubuntu SMP Tue Oct 11 16:11:24 UTC 2011 x86_64
Average over 1000000 iterations
Current time (GMT): Sun Oct 23 09:39:22 2011

SPARSE_HASH_MAP (4 byte objects, 1000000 iterations):
map_grow             1610.0 ns  ( 2677704 hashes,  5677753 copies)
map_predict/grow      630.0 ns  ( 1000000 hashes,  4000005 copies)
map_replace           350.0 ns  ( 3677704 hashes,  5677753 copies)
map_fetch_random      810.0 ns  ( 3677704 hashes,  5677753 copies)
map_fetch_sequential  740.0 ns  ( 3677704 hashes,  5677753 copies)
map_fetch_empty       370.0 ns  (       0 hashes,        1 copies)
map_remove           1120.0 ns  ( 3677704 hashes,  6677753 copies)
map_toggle           2110.0 ns  ( 2039999 hashes,  5159997 copies)

stresshashfunction map_size=256 stride=1: 3001.7ns/insertion
stresshashfunction map_size=256 stride=256: 2361.4ns/insertion
stresshashfunction map_size=1024 stride=1: 5443.1ns/insertion
stresshashfunction map_size=1024 stride=1024: 5883.4ns/insertion

DENSE_HASH_MAP (4 byte objects, 1000000 iterations):
map_grow              700.0 ns  ( 2048576 hashes,  9242963 copies)
map_predict/grow      250.0 ns  ( 1000000 hashes,  6097195 copies)
map_replace           200.0 ns  ( 3048576 hashes,  9242963 copies)
map_fetch_random      230.0 ns  ( 3048576 hashes,  9242963 copies)
map_fetch_sequential  200.0 ns  ( 3048576 hashes,  9242963 copies)
map_fetch_empty        60.0 ns  (       0 hashes,       35 copies)
map_remove            400.0 ns  ( 3048576 hashes, 10242963 copies)
map_toggle           1040.0 ns  ( 2062499 hashes,  7499995 copies)

stresshashfunction map_size=256 stride=1: 1841.1ns/insertion
stresshashfunction map_size=256 stride=256: 520.3ns/insertion
stresshashfunction map_size=1024 stride=1: 2841.6ns/insertion
stresshashfunction map_size=1024 stride=1024: 1520.9ns/insertion

STANDARD HASH_MAP (4 byte objects, 1000000 iterations):
map_grow              240.0 ns  ( 2025530 hashes,  4000000 copies)
map_predict/grow      230.0 ns  ( 1000000 hashes,  4000000 copies)
map_replace            60.0 ns  ( 3025530 hashes,  4000000 copies)
map_fetch_random      220.0 ns  ( 3025530 hashes,  4000000 copies)
map_fetch_sequential  100.0 ns  ( 3025530 hashes,  4000000 copies)
map_fetch_empty       130.0 ns  ( 1000000 hashes,        0 copies)
map_remove            130.0 ns  ( 3025530 hashes,  4000000 copies)
map_toggle            350.0 ns  ( 2000000 hashes,  4000000 copies)

stresshashfunction map_size=256 stride=1: 160.1ns/insertion
stresshashfunction map_size=256 stride=256: 200.1ns/insertion
stresshashfunction map_size=1024 stride=1: 160.1ns/insertion
stresshashfunction map_size=1024 stride=1024: 160.1ns/insertion

gold_hash_map (4 byte objects, 1000000 iterations):
map_grow              200.0 ns  ( 1000000 hashes,  2000000 copies)
map_predict/grow      200.0 ns  ( 1000000 hashes,  2000000 copies)
map_replace            90.0 ns  ( 2000000 hashes,  3000000 copies)
map_fetch_random      200.0 ns  ( 2000000 hashes,  2000000 copies)
map_fetch_sequential   70.0 ns  ( 2000000 hashes,  2000000 copies)
map_fetch_empty        50.0 ns  ( 1000000 hashes,        0 copies)
map_remove            110.0 ns  ( 2000000 hashes,  2000000 copies)
map_toggle            190.0 ns  ( 2000000 hashes,  2000000 copies)

stresshashfunction map_size=256 stride=1: 200.1ns/insertion
stresshashfunction map_size=256 stride=256: 280.2ns/insertion
stresshashfunction map_size=1024 stride=1: 200.1ns/insertion
stresshashfunction map_size=1024 stride=1024: 160.1ns/insertion

STANDARD MAP (4 byte objects, 1000000 iterations):
map_grow              960.0 ns  (       0 hashes,  2000000 copies)
map_predict/grow      950.0 ns  (       0 hashes,  2000000 copies)
map_replace           660.0 ns  (       0 hashes,  2000000 copies)
map_fetch_random     1360.0 ns  (       0 hashes,  2000000 copies)
map_fetch_sequential  720.0 ns  (       0 hashes,  2000000 copies)
map_fetch_empty        50.0 ns  (       0 hashes,        0 copies)
map_remove            790.0 ns  (       0 hashes,  2000000 copies)
map_toggle            390.0 ns  (       0 hashes,  2000000 copies)

SPARSE_HASH_MAP (8 byte objects, 500000 iterations):
map_grow             1860.0 ns  ( 1338843 hashes,  2838889 copies)
map_predict/grow      760.0 ns  (  500000 hashes,  2000005 copies)
map_replace           360.0 ns  ( 1838843 hashes,  2838889 copies)
map_fetch_random      720.0 ns  ( 1838843 hashes,  2838889 copies)
map_fetch_sequential  760.0 ns  ( 1838843 hashes,  2838889 copies)
map_fetch_empty       380.0 ns  (       0 hashes,        1 copies)
map_remove           1140.0 ns  ( 1838843 hashes,  3338889 copies)
map_toggle           2340.0 ns  ( 1019999 hashes,  2579997 copies)

stresshashfunction map_size=256 stride=1: 2801.6ns/insertion
stresshashfunction map_size=256 stride=256: 1761.0ns/insertion
stresshashfunction map_size=1024 stride=1: 5042.9ns/insertion
stresshashfunction map_size=1024 stride=1024: 5443.1ns/insertion

DENSE_HASH_MAP (8 byte objects, 500000 iterations):
map_grow              680.0 ns  ( 1024287 hashes,  4621515 copies)
map_predict/grow      300.0 ns  (  500000 hashes,  3048619 copies)
map_replace           200.0 ns  ( 1524287 hashes,  4621515 copies)
map_fetch_random      200.0 ns  ( 1524287 hashes,  4621515 copies)
map_fetch_sequential  180.0 ns  ( 1524287 hashes,  4621515 copies)
map_fetch_empty        60.0 ns  (       0 hashes,       35 copies)
map_remove            380.0 ns  ( 1524287 hashes,  5121515 copies)
map_toggle            980.0 ns  ( 1031249 hashes,  3749995 copies)

stresshashfunction map_size=256 stride=1: 1360.8ns/insertion
stresshashfunction map_size=256 stride=256: 480.3ns/insertion
stresshashfunction map_size=1024 stride=1: 2481.4ns/insertion
stresshashfunction map_size=1024 stride=1024: 1440.8ns/insertion

STANDARD HASH_MAP (8 byte objects, 500000 iterations):
map_grow              300.0 ns  ( 1005289 hashes,  2000000 copies)
map_predict/grow      260.0 ns  (  500000 hashes,  2000000 copies)
map_replace            80.0 ns  ( 1505289 hashes,  2000000 copies)
map_fetch_random      200.0 ns  ( 1505289 hashes,  2000000 copies)
map_fetch_sequential  120.0 ns  ( 1505289 hashes,  2000000 copies)
map_fetch_empty       100.0 ns  (  500000 hashes,        0 copies)
map_remove            140.0 ns  ( 1505289 hashes,  2000000 copies)
map_toggle            360.0 ns  ( 1000000 hashes,  2000000 copies)

stresshashfunction map_size=256 stride=1: 160.1ns/insertion
stresshashfunction map_size=256 stride=256: 240.1ns/insertion
stresshashfunction map_size=1024 stride=1: 240.1ns/insertion
stresshashfunction map_size=1024 stride=1024: 240.1ns/insertion

gold_hash_map (8 byte objects, 500000 iterations):
map_grow              240.0 ns  (  500000 hashes,  1000000 copies)
map_predict/grow      280.0 ns  (  500000 hashes,  1000000 copies)
map_replace           100.0 ns  ( 1000000 hashes,  1500000 copies)
map_fetch_random      200.0 ns  ( 1000000 hashes,  1000000 copies)
map_fetch_sequential  100.0 ns  ( 1000000 hashes,  1000000 copies)
map_fetch_empty        60.0 ns  (  500000 hashes,        0 copies)
map_remove            160.0 ns  ( 1000000 hashes,  1000000 copies)
map_toggle            220.0 ns  ( 1000000 hashes,  1000000 copies)

stresshashfunction map_size=256 stride=1: 240.1ns/insertion
stresshashfunction map_size=256 stride=256: 80.0ns/insertion
stresshashfunction map_size=1024 stride=1: 160.1ns/insertion
stresshashfunction map_size=1024 stride=1024: 160.1ns/insertion

STANDARD MAP (8 byte objects, 500000 iterations):
map_grow             1020.0 ns  (       0 hashes,  1000000 copies)
map_predict/grow      940.0 ns  (       0 hashes,  1000000 copies)
map_replace           640.0 ns  (       0 hashes,  1000000 copies)
map_fetch_random     1260.0 ns  (       0 hashes,  1000000 copies)
map_fetch_sequential  640.0 ns  (       0 hashes,  1000000 copies)
map_fetch_empty        80.0 ns  (       0 hashes,        0 copies)
map_remove            740.0 ns  (       0 hashes,  1000000 copies)
map_toggle            420.0 ns  (       0 hashes,  1000000 copies)

SPARSE_HASH_MAP (16 byte objects, 250000 iterations):
map_grow             1960.0 ns  (  669412 hashes,  1419455 copies)
map_predict/grow      880.0 ns  (  250000 hashes,  1000005 copies)
map_replace           400.0 ns  (  919412 hashes,  1419455 copies)
map_fetch_random      880.0 ns  (  919412 hashes,  1419455 copies)
map_fetch_sequential  680.0 ns  (  919412 hashes,  1419455 copies)
map_fetch_empty       360.0 ns  (       0 hashes,        1 copies)
map_remove           1160.0 ns  (  919412 hashes,  1669455 copies)
map_toggle           2240.0 ns  (  509999 hashes,  1289997 copies)

DENSE_HASH_MAP (16 byte objects, 250000 iterations):
map_grow              760.0 ns  (  512142 hashes,  2310787 copies)
map_predict/grow      360.0 ns  (  250000 hashes,  1524331 copies)
map_replace           200.0 ns  (  762142 hashes,  2310787 copies)
map_fetch_random      200.0 ns  (  762142 hashes,  2310787 copies)
map_fetch_sequential  240.0 ns  (  762142 hashes,  2310787 copies)
map_fetch_empty        80.0 ns  (       0 hashes,       35 copies)
map_remove            400.0 ns  (  762142 hashes,  2560787 copies)
map_toggle           1000.0 ns  (  515624 hashes,  1874995 copies)

STANDARD HASH_MAP (16 byte objects, 250000 iterations):
map_grow              360.0 ns  (  499010 hashes,  1000000 copies)
map_predict/grow      280.0 ns  (  250000 hashes,  1000000 copies)
map_replace           120.0 ns  (  749010 hashes,  1000000 copies)
map_fetch_random      240.0 ns  (  749010 hashes,  1000000 copies)
map_fetch_sequential  120.0 ns  (  749010 hashes,  1000000 copies)
map_fetch_empty       120.0 ns  (  250000 hashes,        0 copies)
map_remove            200.0 ns  (  749010 hashes,  1000000 copies)
map_toggle            440.0 ns  (  500000 hashes,  1000000 copies)

gold_hash_map (16 byte objects, 250000 iterations):
map_grow              320.0 ns  (  250000 hashes,   500000 copies)
map_predict/grow      280.0 ns  (  250000 hashes,   500000 copies)
map_replace           160.0 ns  (  500000 hashes,   750000 copies)
map_fetch_random      200.0 ns  (  500000 hashes,   500000 copies)
map_fetch_sequential  120.0 ns  (  500000 hashes,   500000 copies)
map_fetch_empty        80.0 ns  (  250000 hashes,        0 copies)
map_remove            160.0 ns  (  500000 hashes,   500000 copies)
map_toggle            280.0 ns  (  500000 hashes,   500000 copies)


STANDARD MAP (16 byte objects, 250000 iterations):
map_grow             1000.0 ns  (       0 hashes,   500000 copies)
map_predict/grow      880.0 ns  (       0 hashes,   500000 copies)
map_replace           640.0 ns  (       0 hashes,   500000 copies)
map_fetch_random     1040.0 ns  (       0 hashes,   500000 copies)
map_fetch_sequential  560.0 ns  (       0 hashes,   500000 copies)
map_fetch_empty        80.0 ns  (       0 hashes,        0 copies)
map_remove            760.0 ns  (       0 hashes,   500000 copies)
map_toggle            440.0 ns  (       0 hashes,   500000 copies)

SPARSE_HASH_MAP (256 byte objects, 31250 iterations):
map_grow             5760.0 ns  (   83659 hashes,   177443 copies)
map_predict/grow     1920.0 ns  (   31250 hashes,   125005 copies)
map_replace          1280.0 ns  (  114909 hashes,   177443 copies)
map_fetch_random     1600.0 ns  (  114909 hashes,   177443 copies)
map_fetch_sequential 1600.0 ns  (  114909 hashes,   177443 copies)
map_fetch_empty       320.0 ns  (       0 hashes,        1 copies)
map_remove           2560.0 ns  (  114909 hashes,   208693 copies)
map_toggle           3840.0 ns  (   63749 hashes,   161247 copies)

DENSE_HASH_MAP (256 byte objects, 31250 iterations):
map_grow             2880.0 ns  (   64013 hashes,   288883 copies)
map_predict/grow     1280.0 ns  (   31250 hashes,   190579 copies)
map_replace          1280.0 ns  (   95263 hashes,   288883 copies)
map_fetch_random      960.0 ns  (   95263 hashes,   288883 copies)
map_fetch_sequential  960.0 ns  (   95263 hashes,   288883 copies)
map_fetch_empty       320.0 ns  (       0 hashes,       35 copies)
map_remove           1280.0 ns  (   95263 hashes,   320133 copies)
map_toggle           2560.0 ns  (   64453 hashes,   234405 copies)

STANDARD HASH_MAP (256 byte objects, 31250 iterations):
map_grow             2880.0 ns  (   91756 hashes,   125000 copies)
map_predict/grow     1280.0 ns  (   31250 hashes,   125000 copies)
map_replace           960.0 ns  (  123006 hashes,   125000 copies)
map_fetch_random      960.0 ns  (  123006 hashes,   125000 copies)
map_fetch_sequential  960.0 ns  (  123006 hashes,   125000 copies)
map_fetch_empty       960.0 ns  (   31250 hashes,        0 copies)
map_remove            960.0 ns  (  123006 hashes,   125000 copies)
map_toggle           1920.0 ns  (   62500 hashes,   125000 copies)

gold_hash_map (256 byte objects, 31250 iterations):
map_grow             1280.0 ns  (   31250 hashes,    31250 copies)
map_predict/grow     1280.0 ns  (   31250 hashes,    31250 copies)
map_replace          1280.0 ns  (   62500 hashes,    31250 copies)
map_fetch_random      960.0 ns  (   62500 hashes,    31250 copies)
map_fetch_sequential  960.0 ns  (   62500 hashes,    31250 copies)
map_fetch_empty       960.0 ns  (   31250 hashes,        0 copies)
map_remove            960.0 ns  (   62500 hashes,    31250 copies)
map_toggle           2240.0 ns  (   62500 hashes,    31250 copies)


STANDARD MAP (256 byte objects, 31250 iterations):
map_grow              640.0 ns  (       0 hashes,    62500 copies)
map_predict/grow      640.0 ns  (       0 hashes,    62500 copies)
map_replace           320.0 ns  (       0 hashes,    62500 copies)
map_fetch_random      640.0 ns  (       0 hashes,    62500 copies)
map_fetch_sequential  640.0 ns  (       0 hashes,    62500 copies)
map_fetch_empty         0.0 ns  (       0 hashes,        0 copies)
map_remove            640.0 ns  (       0 hashes,    62500 copies)
map_toggle            640.0 ns  (       0 hashes,    62500 copies)

©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值