replace benchpress with google benchmark

This commit is contained in:
Daniel Sipka 2015-10-02 14:29:15 +02:00
parent 0cff1cbb1e
commit 8c3b7a1d4b
6 changed files with 16 additions and 15 deletions

6
.gitmodules vendored
View File

@ -7,6 +7,6 @@
[submodule "vendor/spec"]
path = vendor/spec
url = https://github.com/mustache/spec.git
[submodule "vendor/benchpress"]
path = vendor/benchpress
url = https://github.com/bigdatadev/benchpress.git
[submodule "vendor/benchmark"]
path = vendor/benchmark
url = https://github.com/google/benchmark.git

View File

@ -19,6 +19,7 @@ if(WITH_UNIT_TESTS)
include_directories(
vendor/Catch/single_include
vendor/json.hpp/include
vendor/benchpress/src/benchpress)
vendor/benchmark/include)
add_subdirectory(vendor/benchmark)
add_subdirectory(test)
endif()

View File

@ -4,8 +4,8 @@ include_directories(
${CMAKE_SOURCE_DIR}/include
${Boost_INCLUDE_DIR})
add_executable(benchmark benchmark_main.cpp)
target_link_libraries(benchmark mstch)
add_executable(mstch_benchmark benchmark_main.cpp)
target_link_libraries(mstch_benchmark mstch benchmark)
add_executable(headerize headerize.cpp)
target_link_libraries(headerize ${Boost_PROGRAM_OPTIONS_LIBRARY})

View File

@ -1,10 +1,8 @@
#define BENCHPRESS_CONFIG_MAIN
#include <benchpress.hpp>
#include <benchmark/benchmark.h>
#include "mstch/mstch.hpp"
benchpress::auto_register basic_usage("basic usage", [](benchpress::context* ctx) {
static void basic_usage(benchmark::State& state) {
std::string comment_tmp{
"<div class=\"comments\"><h3>{{header}}</h3><ul>"
"{{#comments}}<li class=\"comment\"><h5>{{name}}</h5>"
@ -19,8 +17,10 @@ benchpress::auto_register basic_usage("basic usage", [](benchpress::context* ctx
mstch::map{{"name", std::string{"Kathy"}}, {"body", std::string{"Thanks for this post!"}}},
mstch::map{{"name", std::string{"George"}}, {"body", std::string{"Thanks for this post!"}}}}}};
ctx->reset_timer();
for (size_t i = 0; i < ctx->num_iterations(); ++i)
while (state.KeepRunning())
mstch::render(comment_tmp, comment_view);
});
}
BENCHMARK(basic_usage);
BENCHMARK_MAIN();

1
vendor/benchmark vendored Submodule

@ -0,0 +1 @@
Subproject commit cf40a0f1172afc061e910eb5590f71e6ffdece66

1
vendor/benchpress vendored

@ -1 +0,0 @@
Subproject commit 469b7c6b0b582389fa397d9b990a0ff1c3b93462