From 9209046797fc50ae47346b3c389150b147219a34 Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Thu, 1 Jun 2017 12:44:37 -0300 Subject: [PATCH] Make benchmarks optional and dependent on hopscotch_map. --- configure.ac | 8 ++++++++ cxxmph/Makefile.am | 4 +++- cxxmph/bm_map.cc | 6 +----- m4/acinclude.m4 | 8 ++++++++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 49be89c..2b958f8 100644 --- a/configure.ac +++ b/configure.ac @@ -53,6 +53,14 @@ if test x$cxxmph = xtrue; then fi AM_CONDITIONAL([USE_CXXMPH], [test "$cxxmph" = true]) +AC_ENABLE_BENCHMARKS +if test x$benchmarks = xtrue; then + AC_LANG_PUSH([C++]) + AC_CHECK_HEADERS([hopscotch_map.h]) + AC_LANG_POP([C++]) +fi +AM_CONDITIONAL([USE_BENCHMARKS], [test "$benchmarks" = true]) + # Unit tests based on the check library. Disabled by default. # We do not use pkg-config because it is inconvenient for all developers to # have check library installed. diff --git a/cxxmph/Makefile.am b/cxxmph/Makefile.am index b542000..4ebaccb 100644 --- a/cxxmph/Makefile.am +++ b/cxxmph/Makefile.am @@ -5,7 +5,9 @@ if USE_LIBCHECK check_LTLIBRARIES = libcxxmph_test.la endif -noinst_PROGRAMS = bm_map # bm_index - disabled because of cmph dependency +if USE_BENCHMARKS + noinst_PROGRAMS = bm_map # bm_index - disabled because of cmph dependency +endif bin_PROGRAMS = cxxmph cxxmph_includedir = $(includedir)/cxxmph/ diff --git a/cxxmph/bm_map.cc b/cxxmph/bm_map.cc index a907e47..09a3bc5 100644 --- a/cxxmph/bm_map.cc +++ b/cxxmph/bm_map.cc @@ -1,7 +1,7 @@ #include #include + #include "hopscotch_map.h" -#include "flat_hash_map.hpp" #include "bm_common.h" #include "mph_map.h" @@ -104,27 +104,23 @@ int main(int argc, char** argv) { Benchmark::Register(new BM_CreateUrls>("URLS100k")); Benchmark::Register(new BM_CreateUrls>("URLS100k")); Benchmark::Register(new BM_CreateUrls>("URLS100k")); - Benchmark::Register(new BM_CreateUrls>("URLS100k")); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0)); - Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0.9)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0.9)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0.9)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0.9)); Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0.9)); - Benchmark::Register(new BM_SearchUrls>("URLS100k", 10*1000 * 1000, 0.9)); Benchmark::Register(new BM_SearchUint64>); Benchmark::Register(new BM_SearchUint64>); Benchmark::Register(new BM_SearchUint64>); Benchmark::Register(new BM_SearchUint64>); Benchmark::Register(new BM_SearchUint64>); - Benchmark::Register(new BM_SearchUint64>); Benchmark::RunAll(); } diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 index 07e81d1..370d63b 100644 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -5,3 +5,11 @@ AC_DEFUN([AC_ENABLE_CXXMPH], [AC_ARG_ENABLE([cxxmph], no) cxxmph=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-cxxmph]) ;; esac],[cxxmph=false])]) + +AC_DEFUN([AC_ENABLE_BENCHMARKS], [AC_ARG_ENABLE([benchmarks], + [ --enable-benchmarks enable cxxmph benchmarks against other libs ], + [case "${enableval}" in + yes) benchmarks=true ;; + no) benchmarks=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-benchmarks]) ;; + esac],[benchmarks=false])])