Move benchmarks to bench/

This commit is contained in:
Vinnie Falco
2017-07-28 13:24:39 -07:00
parent e15448a83a
commit 698884d8bb
21 changed files with 65 additions and 53 deletions

View File

@@ -13,6 +13,7 @@ Version 91:
* Use fopen_s on Windows
* Fix Appveyor script
* Update project metadata
* Move benchmarks to bench/
WebSocket:

View File

@@ -12,6 +12,7 @@ cmake_minimum_required (VERSION 3.5.2)
project (Beast VERSION 90)
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
option (Beast_BUILD_BENCH "Build bench" ON)
option (Beast_BUILD_EXAMPLES "Build examples" ON)
option (Beast_BUILD_TESTS "Build tests" ON)
@@ -189,8 +190,8 @@ file(GLOB_RECURSE EXTRAS_INCLUDES
${PROJECT_SOURCE_DIR}/extras/boost/beast/*.ipp
)
if (Beast_BUILD_TESTS)
add_subdirectory (test)
if (Beast_BUILD_BENCH)
add_subdirectory (bench)
endif()
if (Beast_BUILD_EXAMPLES AND
@@ -198,3 +199,7 @@ if (Beast_BUILD_EXAMPLES AND
(NOT "${VARIANT}" STREQUAL "ubasan"))
add_subdirectory (example)
endif()
if (Beast_BUILD_TESTS)
add_subdirectory (test)
endif()

31
Jamfile
View File

@@ -19,36 +19,36 @@ boost.use-project ;
if [ os.name ] = SOLARIS
{
lib socket ;
lib nsl ;
lib socket ;
lib nsl ;
}
else if [ os.name ] = NT
{
lib ws2_32 ;
lib mswsock ;
lib ws2_32 ;
lib mswsock ;
}
else if [ os.name ] = HPUX
{
lib ipv6 ;
lib ipv6 ;
}
else if [ os.name ] = QNXNTO
{
lib socket ;
lib socket ;
}
else if [ os.name ] = HAIKU
{
lib network ;
lib network ;
}
if [ os.name ] = NT
{
lib ssl : : <name>ssleay32 ;
lib crypto : : <name>libeay32 ;
lib ssl : : <name>ssleay32 ;
lib crypto : : <name>libeay32 ;
}
else
{
lib ssl ;
lib crypto ;
lib ssl ;
lib crypto ;
}
variant coverage :
@@ -59,16 +59,18 @@ variant coverage :
;
variant ubasan
:
:
release
:
:
<cxxflags>"-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=libs/beast/scripts/blacklist.supp"
<linkflags>"-fsanitize=address,undefined"
;
;
#cxx11_hdr_type_traits
local REQ = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_hdr_tuple ] ;
path-constant TEST_MAIN : extras/boost/beast/unit_test/main.cpp ;
project beast
: requirements
#$(REQ)
@@ -79,6 +81,7 @@ project beast
<library>/boost/system//boost_system
<library>/boost/coroutine//boost_coroutine/<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
<library>/boost/filesystem//boost_filesystem
<link>static
<define>BOOST_ALL_NO_LIB=1
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
<threading>multi

View File

@@ -110,14 +110,16 @@ The files in the repository are laid out thusly:
```
./
bench/ Benchmarking programs
bin/ Create this to hold executables and project files
bin64/ Create this to hold 64-bit Windows executables and project files
doc/ Source code and scripts for the documentation
include/ Add this to your compiler includes
beast/
include/ Where the header files live
extras/ Additional APIs, may change
example/ Self contained example programs
test/ Unit tests and benchmarks
meta/ Metadata for Boost integration
scripts/ Small scripts used with CI systems
test/ Unit tests
```
## Usage

View File

@@ -16,11 +16,13 @@ add_executable (benchmarks
${BOOST_BEAST_INCLUDES}
${EXTRAS_INCLUDES}
Jamfile
../../extras/boost/beast/unit_test/main.cpp
../http/message_fuzz.hpp
../extras/boost/beast/unit_test/main.cpp
../test/http/message_fuzz.hpp
nodejs_parser.hpp
buffers.cpp
nodejs_parser.cpp
buffers.cpp
parser.cpp
utf8_checker.cpp
)
add_subdirectory (wstest)

View File

@@ -9,13 +9,14 @@
local SOURCES =
buffers.cpp
nodejs_parser.cpp
parser.cpp
#utf8_checker.cpp # causes unnecessary dependencies
utf8_checker.cpp # causes unnecessary dependencies
;
unit-test run-fat : $(TEST_MAIN) $(SOURCES) : : : <variant>coverage:<build>no <variant>ubasan:<build>no ;
explicit run-fat ;
local BUILD_BENCH ; for local f in $(SOURCES) { BUILD_BENCH += [ exe $(f:B)-bench : $(f) $(TEST_MAIN) ] ; }
alias build-bench : $(BUILD_BENCH) ;
exe build-fat : $(TEST_MAIN) $(SOURCES) : : : <variant>coverage:<build>no <variant>ubasan:<build>no ;
explicit build-fat ;
exe parser-bench :
nodejs_parser.cpp
parser.cpp
$(TEST_MAIN)
;

View File

@@ -8,7 +8,7 @@
//
#include "nodejs_parser.hpp"
#include "../http/message_fuzz.hpp"
#include "test/http/message_fuzz.hpp"
#include <boost/beast/http.hpp>
#include <boost/beast/core/consuming_buffers.hpp>

View File

@@ -9,10 +9,17 @@
#include <boost/beast/websocket/detail/utf8_checker.hpp>
#include <boost/beast/unit_test/suite.hpp>
#include <boost/locale.hpp>
#include <chrono>
#include <random>
#ifndef BEAST_USE_BOOST_LOCALE_BENCHMARK
#define BEAST_USE_BOOST_LOCALE_BENCHMARK 0
#endif
#if BEAST_USE_BOOST_LOCALE_BENCHMARK
#include <boost/locale.hpp>
#endif
namespace boost {
namespace beast {
@@ -79,6 +86,14 @@ public:
return s;
}
void
checkBeast(std::string const& s)
{
beast::websocket::detail::check_utf8(
s.data(), s.size());
}
#if BEAST_USE_BOOST_LOCALE_BENCHMARK
void
checkLocale(std::string const& s)
{
@@ -92,13 +107,7 @@ public:
break;
}
}
void
checkBeast(std::string const& s)
{
beast::websocket::detail::check_utf8(
s.data(), s.size());
}
#endif
template<class F>
typename timer::clock_type::duration
@@ -124,6 +133,7 @@ public:
});
log << "beast: " << throughput(elapsed, s.size()) << " char/s" << std::endl;
}
#if BEAST_USE_BOOST_LOCALE_BENCHMARK
for(int i = 0; i < 5; ++ i)
{
auto const elapsed = test([&]{
@@ -135,6 +145,7 @@ public:
});
log << "locale: " << throughput(elapsed, s.size()) << " char/s" << std::endl;
}
#endif
pass();
}
};

View File

@@ -10,7 +10,7 @@
GroupSources(include/boost/beast beast)
GroupSources(example/common common)
GroupSources(extras/boost/beast extras)
GroupSources(test/wstest "/")
GroupSources(bench/wstest "/")
add_executable (wstest
${BOOST_BEAST_INCLUDES}

View File

@@ -7,9 +7,6 @@
# Official repository: https://github.com/boostorg/beast
#
alias wstest :
exe wstest :
wstest.cpp
;
explicit wstest ;
alias run-tests : [ compile wstest.cpp ] : : : <variant>coverage:<build>no <variant>ubasan:<build>no ;

View File

@@ -10,13 +10,11 @@
add_subdirectory (core)
add_subdirectory (http)
add_subdirectory (websocket)
add_subdirectory (wstest)
add_subdirectory (zlib)
if ((NOT "${VARIANT}" STREQUAL "coverage") AND
(NOT "${VARIANT}" STREQUAL "ubasan"))
add_subdirectory (benchmarks)
add_subdirectory (common)
add_subdirectory (server)

View File

@@ -9,8 +9,6 @@
import os ;
path-constant TEST_MAIN : ../extras/boost/beast/unit_test/main.cpp ;
compile config.cpp : <variant>coverage:<build>no <variant>ubasan:<build>no ;
compile core.cpp : <variant>coverage:<build>no <variant>ubasan:<build>no ;
compile exemplars.cpp : <variant>coverage:<build>no <variant>ubasan:<build>no ;
@@ -20,36 +18,30 @@ compile websocket.cpp : <variant>coverage:<build>no <variant>ubasan:<build>no ;
compile zlib.cpp : <variant>coverage:<build>no <variant>ubasan:<build>no ;
alias run-tests :
#benchmarks//run-tests # not necessary
common//run-tests
core//run-tests
http//run-tests
server//run-tests
websocket//run-tests
wstest//run-tests
zlib//run-tests
;
alias run-fat :
benchmarks//run-fat
common//run-fat
core//run-fat
http//run-fat
server//run-fat
websocket//run-fat
#wstest//run-fat # not available
zlib//run-fat
;
explicit run-fat ;
alias build-fat :
benchmarks//build-fat
common//build-fat
core//build-fat
http//build-fat
server//build-fat
websocket//build-fat
#wstest//build-fat # not available
zlib//build-fat
;
explicit build-fat ;