diff --git a/bench/Makefile b/bench/Makefile index 207e3221..a40efcdd 100644 --- a/bench/Makefile +++ b/bench/Makefile @@ -399,6 +399,14 @@ bench-CC0: @./bench-CC.exe 40 @./bench-CC.exe 41 +# VERSTABLE shall point to the source directory of VERSTABLE (where the headers are) +bench-verstable: + @if test -n "$${VERSTABLE}" ; then $(MAKE) bench-verstable0 ; else echo "Nothing to be done for VERSTABLE." ; fi + +bench-verstable0: + $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -I $${VERSTABLE}/ bench-verstable.c common.c -o bench-verstable.exe + @./bench-verstable.exe 40 + ############################################################################ bench-mlib-json: bench-mlib diff --git a/bench/bench-verstable.c b/bench/bench-verstable.c new file mode 100644 index 00000000..6d6f1077 --- /dev/null +++ b/bench/bench-verstable.c @@ -0,0 +1,48 @@ +#define NDEBUG + +#include +#include +#include + +#include "common.h" + +#define NAME umap_ulong +#define KEY_TY unsigned long +#define VAL_TY unsigned long +#include "verstable.h" + +static void +test_dict(size_t n) +{ + umap_ulong dict; + umap_ulong_init(&dict); + + for (size_t i = 0; i < n; i++) { + unsigned long value = rand_get(); + unsigned long key = rand_get(); + umap_ulong_insert(&dict, key, value); + } + rand_init(); + unsigned int s = 0; + for (size_t i = 0; i < n; i++) { + umap_ulong_itr it = umap_ulong_get(&dict, rand_get()); + if (!umap_ulong_is_end(it) ) + s += it.data->val; + } + g_result = s; + + umap_ulong_cleanup(&dict); +} + +/********************************************************************************************/ + +const config_func_t table[] = { + { 40, "dict", 1000000, 0, test_dict, 0}, +}; + +int main(int argc, const char *argv[]) +{ + test("CTL", numberof(table), table, argc, argv); + exit(0); +} +