mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-13 01:36:27 +07:00
optional boost bench
This commit is contained in:
@@ -7,8 +7,8 @@ project(flat.hpp.unbench)
|
||||
# boost
|
||||
#
|
||||
|
||||
find_package(Boost REQUIRED
|
||||
COMPONENTS container)
|
||||
find_package(Boost
|
||||
OPTIONAL_COMPONENTS container)
|
||||
|
||||
#
|
||||
# google benchmark
|
||||
@@ -33,8 +33,16 @@ endif()
|
||||
|
||||
file(GLOB UNBENCH_SOURCES "*.cpp" "*.hpp")
|
||||
add_executable(${PROJECT_NAME} ${UNBENCH_SOURCES})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Boost::container
|
||||
benchmark_main
|
||||
flat.hpp)
|
||||
|
||||
if(Boost_CONTAINER_FOUND)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Boost::container)
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PRIVATE BOOST_CONTAINER_FOUND)
|
||||
endif()
|
||||
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
|
||||
@@ -10,7 +10,9 @@ using namespace flat_hpp_unbench;
|
||||
#include <flat_hpp/flat_map.hpp>
|
||||
using namespace flat_hpp;
|
||||
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#ifdef BOOST_CONTAINER_FOUND
|
||||
# include <boost/container/flat_map.hpp>
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -26,6 +28,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_CONTAINER_FOUND
|
||||
template < typename Value >
|
||||
void boost_flat_map_insert(benchmark::State& state) {
|
||||
std::vector<int> v;
|
||||
@@ -37,6 +40,7 @@ namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template < typename Value >
|
||||
void std_map_insert(benchmark::State& state) {
|
||||
@@ -67,9 +71,11 @@ BENCHMARK_TEMPLATE(flat_map_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
->DenseRange(1,401,50);
|
||||
|
||||
BENCHMARK_TEMPLATE(boost_flat_map_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
->DenseRange(1,401,50);
|
||||
#ifdef BOOST_CONTAINER_FOUND
|
||||
BENCHMARK_TEMPLATE(boost_flat_map_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
->DenseRange(1,401,50);
|
||||
#endif
|
||||
|
||||
BENCHMARK_TEMPLATE(std_map_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
|
||||
@@ -10,7 +10,9 @@ using namespace flat_hpp_unbench;
|
||||
#include <flat_hpp/flat_set.hpp>
|
||||
using namespace flat_hpp;
|
||||
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#ifdef BOOST_CONTAINER_FOUND
|
||||
# include <boost/container/flat_set.hpp>
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -26,6 +28,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_CONTAINER_FOUND
|
||||
template < typename Key >
|
||||
void boost_flat_set_insert(benchmark::State& state) {
|
||||
std::vector<int> v;
|
||||
@@ -37,6 +40,7 @@ namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template < typename Key >
|
||||
void std_set_insert(benchmark::State& state) {
|
||||
@@ -67,9 +71,11 @@ BENCHMARK_TEMPLATE(flat_set_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
->DenseRange(1,401,50);
|
||||
|
||||
BENCHMARK_TEMPLATE(boost_flat_set_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
->DenseRange(1,401,50);
|
||||
#ifdef BOOST_CONTAINER_FOUND
|
||||
BENCHMARK_TEMPLATE(boost_flat_set_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
->DenseRange(1,401,50);
|
||||
#endif
|
||||
|
||||
BENCHMARK_TEMPLATE(std_set_insert, vec4)
|
||||
->ComputeStatistics("min", min_bench_statistics)
|
||||
|
||||
Reference in New Issue
Block a user