From 8daeea9a5dc2c68c8e54fe7bdae98cec7072a9cd Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 15 Apr 2020 20:37:54 +0200 Subject: vppinfra: don't use memcmp to compare keys in cuckoo Type: improvement Change-Id: I7e11bf72be5fad5967724c038eb649a261294ca0 Signed-off-by: Damjan Marion --- src/vppinfra/cuckoo_16_8.h | 2 -- src/vppinfra/cuckoo_8_8.h | 2 -- src/vppinfra/cuckoo_common.h | 1 - src/vppinfra/cuckoo_template.h | 6 +----- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/vppinfra/cuckoo_16_8.h b/src/vppinfra/cuckoo_16_8.h index 0cc7b57bee0..b667ff6cbb8 100644 --- a/src/vppinfra/cuckoo_16_8.h +++ b/src/vppinfra/cuckoo_16_8.h @@ -31,11 +31,9 @@ #include #undef CLIB_CUCKOO_OPTIMIZE_PREFETCH -#undef CLIB_CUCKOO_OPTIMIZE_CMP_REDUCED_HASH #undef CLIB_CUCKOO_OPTIMIZE_UNROLL #undef CLIB_CUCKOO_OPTIMIZE_USE_COUNT_LIMITS_SEARCH #define CLIB_CUCKOO_OPTIMIZE_PREFETCH 1 -#define CLIB_CUCKOO_OPTIMIZE_CMP_REDUCED_HASH 1 #define CLIB_CUCKOO_OPTIMIZE_UNROLL 1 #define CLIB_CUCKOO_OPTIMIZE_USE_COUNT_LIMITS_SEARCH 1 diff --git a/src/vppinfra/cuckoo_8_8.h b/src/vppinfra/cuckoo_8_8.h index ace535b58f6..67af79c0e50 100644 --- a/src/vppinfra/cuckoo_8_8.h +++ b/src/vppinfra/cuckoo_8_8.h @@ -31,11 +31,9 @@ #include #undef CLIB_CUCKOO_OPTIMIZE_PREFETCH -#undef CLIB_CUCKOO_OPTIMIZE_CMP_REDUCED_HASH #undef CLIB_CUCKOO_OPTIMIZE_UNROLL #undef CLIB_CUCKOO_OPTIMIZE_USE_COUNT_LIMITS_SEARCH #define CLIB_CUCKOO_OPTIMIZE_PREFETCH 1 -#define CLIB_CUCKOO_OPTIMIZE_CMP_REDUCED_HASH 1 #define CLIB_CUCKOO_OPTIMIZE_UNROLL 1 #define CLIB_CUCKOO_OPTIMIZE_USE_COUNT_LIMITS_SEARCH 1 diff --git a/src/vppinfra/cuckoo_common.h b/src/vppinfra/cuckoo_common.h index 8b7b27aec30..ea0fc30084b 100644 --- a/src/vppinfra/cuckoo_common.h +++ b/src/vppinfra/cuckoo_common.h @@ -24,7 +24,6 @@ #include #define CLIB_CUCKOO_OPTIMIZE_PREFETCH 1 -#define CLIB_CUCKOO_OPTIMIZE_CMP_REDUCED_HASH 1 #define CLIB_CUCKOO_OPTIMIZE_UNROLL 1 #define CLIB_CUCKOO_OPTIMIZE_USE_COUNT_LIMITS_SEARCH 1 diff --git a/src/vppinfra/cuckoo_template.h b/src/vppinfra/cuckoo_template.h index d48079a9e6c..364c2919d96 100644 --- a/src/vppinfra/cuckoo_template.h +++ b/src/vppinfra/cuckoo_template.h @@ -383,11 +383,7 @@ always_inline int CV (clib_cuckoo_bucket_search) (CVT (clib_cuckoo_bucket) * break; } #endif - if ( -#if CLIB_CUCKOO_OPTIMIZE_CMP_REDUCED_HASH - reduced_hash == b->reduced_hashes[i] && -#endif - 0 == memcmp (&kvp->key, &b->elts[i].key, sizeof (kvp->key))) + if (CV (clib_cuckoo_key_compare) (kvp->key, b->elts[i].key)) { kvp->value = b->elts[i].value; clib_cuckoo_bucket_aux_t bucket_aux2 = b->aux; -- cgit 1.2.3-korg