diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-01-27 16:03:08 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-01-27 16:03:08 +0000 |
commit | f6cbd5ba48d9072b7dda7d3043c88b06b8296f46 (patch) | |
tree | ddc2d8a1787a33918ba4f832b4c04b75e71a86e0 /src/libutil/mem_pool_internal.h | |
parent | fab141472d7aa115b2fc603b9e6723e2dbebda7a (diff) | |
download | rspamd-f6cbd5ba48d9072b7dda7d3043c88b06b8296f46.tar.gz rspamd-f6cbd5ba48d9072b7dda7d3043c88b06b8296f46.zip |
[Rework] Use faster hashing approach for memory pools variables
Diffstat (limited to 'src/libutil/mem_pool_internal.h')
-rw-r--r-- | src/libutil/mem_pool_internal.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libutil/mem_pool_internal.h b/src/libutil/mem_pool_internal.h index 1f253e790..24bd77a71 100644 --- a/src/libutil/mem_pool_internal.h +++ b/src/libutil/mem_pool_internal.h @@ -41,6 +41,7 @@ struct rspamd_mempool_entry_point { gchar src[ENTRY_LEN]; guint32 cur_suggestion; guint32 cur_elts; + guint32 cur_vars; struct entry_elt elts[ENTRY_NELTS]; }; @@ -55,11 +56,21 @@ struct _pool_destructors { struct _pool_destructors *next; }; + +struct rspamd_mempool_variable { + gpointer data; + rspamd_mempool_destruct_t dtor; +}; + +KHASH_INIT (rspamd_mempool_vars_hash, + guint32, struct rspamd_mempool_variable, 1, + kh_int_hash_func, kh_int_hash_equal); + struct rspamd_mempool_specific { struct _pool_chain *pools[RSPAMD_MEMPOOL_MAX]; struct _pool_destructors *dtors_head, *dtors_tail; GPtrArray *trash_stack; - GHashTable *variables; /**< private memory pool variables */ + khash_t(rspamd_mempool_vars_hash) *variables; struct rspamd_mempool_entry_point *entry; gsize elt_len; /**< size of an element */ gsize used_memory; |