From 9d40e6b52f03bbba58b306d79e096d79dd7b1d3e Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sat, 4 Jan 2014 08:39:57 -0500 Subject: [PATCH] ck_ht: Optimize ck_ht_gc for empty tables. --- src/ck_ht.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ck_ht.c b/src/ck_ht.c index 3e83281..ea9de1e 100644 --- a/src/ck_ht.c +++ b/src/ck_ht.c @@ -388,6 +388,14 @@ ck_ht_gc(struct ck_ht *ht, unsigned long cycles, unsigned long seed) uint64_t maximum, i; uint64_t size = 0; + if (map->n_entries == 0) { + ck_pr_store_64(&map->probe_maximum, 0); + if (map->probe_bound != NULL) + memset(map->probe_bound, 0, sizeof(CK_HT_WORD) * map->capacity); + + return true; + } + if (cycles == 0) { maximum = 0;