Becnh dict+mempool

This commit is contained in:
Patrick Pelissier committed 2017-04-02 10:31:06 +02:00
1 parent 2dd3b727ff
commit 7f339f1358
1 file changed
+20
+20
View File
@@ -132,11 +132,18 @@ static void test_rbtree(size_t n)
/********************************************************************************************/
#ifdef USE_MEMPOOL
DICT_DEF2(ulong, unsigned long, M_OPLIST_CAT((MEMPOOL(dict_mpool), MEMPOOL_LINKAGE(static)),M_DEFAULT_OPLIST), unsigned long, M_DEFAULT_OPLIST)
#else
DICT_DEF2(ulong, unsigned long, M_DEFAULT_OPLIST, unsigned long, M_DEFAULT_OPLIST)
#endif
static void
test_dict(unsigned long n)
{
#ifdef USE_MEMPOOL
mempool_list_dict_pair_ulong_init(dict_mpool);
#endif
rand_init();
M_LET(dict, DICT_OPLIST(ulong)) {
for (size_t i = 0; i < n; i++) {
@@ -151,6 +158,9 @@ test_dict(unsigned long n)
}
g_result = s;
}
#ifdef USE_MEMPOOL
mempool_list_dict_pair_ulong_clear(dict_mpool);
#endif
}
/********************************************************************************************/
@@ -165,11 +175,18 @@ static size_t char_hash(const char_array_t a) { return m_core_hash (a, strlen(a)
// NOTE: Can't set OPLIST as a macro!
#define CHAR_OPLIST (INIT(char_init), INIT_SET(char_set), SET(char_set), CLEAR(char_init), HASH(char_hash), EQUAL(char_equal_p))
#ifdef USE_MEMPOOL
DICT_DEF2(char, char_array_t, M_OPLIST_CAT((MEMPOOL(dict_mpool2), MEMPOOL_LINKAGE(static)),CHAR_OPLIST), char_array_t, CHAR_OPLIST)
#else
DICT_DEF2(char, char_array_t, CHAR_OPLIST, char_array_t, CHAR_OPLIST)
#endif
static void
test_dict_big(unsigned long n)
{
#ifdef USE_MEMPOOL
mempool_list_dict_pair_char_init(dict_mpool2);
#endif
rand_init();
M_LET(dict, DICT_OPLIST(char)) {
for (size_t i = 0; i < n; i++) {
@@ -188,6 +205,9 @@ test_dict_big(unsigned long n)
}
g_result = s;
}
#ifdef USE_MEMPOOL
mempool_list_dict_pair_char_clear(dict_mpool2);
#endif
}
/********************************************************************************************/