replace benchpress with google benchmark
This commit is contained in:
parent
0cff1cbb1e
commit
8c3b7a1d4b
6 changed files with 16 additions and 15 deletions
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -7,6 +7,6 @@
|
||||||
[submodule "vendor/spec"]
|
[submodule "vendor/spec"]
|
||||||
path = vendor/spec
|
path = vendor/spec
|
||||||
url = https://github.com/mustache/spec.git
|
url = https://github.com/mustache/spec.git
|
||||||
[submodule "vendor/benchpress"]
|
[submodule "vendor/benchmark"]
|
||||||
path = vendor/benchpress
|
path = vendor/benchmark
|
||||||
url = https://github.com/bigdatadev/benchpress.git
|
url = https://github.com/google/benchmark.git
|
||||||
|
|
|
@ -19,6 +19,7 @@ if(WITH_UNIT_TESTS)
|
||||||
include_directories(
|
include_directories(
|
||||||
vendor/Catch/single_include
|
vendor/Catch/single_include
|
||||||
vendor/json.hpp/include
|
vendor/json.hpp/include
|
||||||
vendor/benchpress/src/benchpress)
|
vendor/benchmark/include)
|
||||||
|
add_subdirectory(vendor/benchmark)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -4,8 +4,8 @@ include_directories(
|
||||||
${CMAKE_SOURCE_DIR}/include
|
${CMAKE_SOURCE_DIR}/include
|
||||||
${Boost_INCLUDE_DIR})
|
${Boost_INCLUDE_DIR})
|
||||||
|
|
||||||
add_executable(benchmark benchmark_main.cpp)
|
add_executable(mstch_benchmark benchmark_main.cpp)
|
||||||
target_link_libraries(benchmark mstch)
|
target_link_libraries(mstch_benchmark mstch benchmark)
|
||||||
|
|
||||||
add_executable(headerize headerize.cpp)
|
add_executable(headerize headerize.cpp)
|
||||||
target_link_libraries(headerize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(headerize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
#define BENCHPRESS_CONFIG_MAIN
|
#include <benchmark/benchmark.h>
|
||||||
|
|
||||||
#include <benchpress.hpp>
|
|
||||||
|
|
||||||
#include "mstch/mstch.hpp"
|
#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{
|
std::string comment_tmp{
|
||||||
"<div class=\"comments\"><h3>{{header}}</h3><ul>"
|
"<div class=\"comments\"><h3>{{header}}</h3><ul>"
|
||||||
"{{#comments}}<li class=\"comment\"><h5>{{name}}</h5>"
|
"{{#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{"Kathy"}}, {"body", std::string{"Thanks for this post!"}}},
|
||||||
mstch::map{{"name", std::string{"George"}}, {"body", std::string{"Thanks for this post!"}}}}}};
|
mstch::map{{"name", std::string{"George"}}, {"body", std::string{"Thanks for this post!"}}}}}};
|
||||||
|
|
||||||
ctx->reset_timer();
|
while (state.KeepRunning())
|
||||||
|
|
||||||
for (size_t i = 0; i < ctx->num_iterations(); ++i)
|
|
||||||
mstch::render(comment_tmp, comment_view);
|
mstch::render(comment_tmp, comment_view);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
BENCHMARK(basic_usage);
|
||||||
|
|
||||||
|
BENCHMARK_MAIN();
|
||||||
|
|
1
vendor/benchmark
vendored
Submodule
1
vendor/benchmark
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit cf40a0f1172afc061e910eb5590f71e6ffdece66
|
1
vendor/benchpress
vendored
1
vendor/benchpress
vendored
|
@ -1 +0,0 @@
|
||||||
Subproject commit 469b7c6b0b582389fa397d9b990a0ff1c3b93462
|
|
Loading…
Reference in a new issue