mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 22:34:32 +02:00
Move benchmarks to bench/
This commit is contained in:
@@ -13,6 +13,7 @@ Version 91:
|
|||||||
* Use fopen_s on Windows
|
* Use fopen_s on Windows
|
||||||
* Fix Appveyor script
|
* Fix Appveyor script
|
||||||
* Update project metadata
|
* Update project metadata
|
||||||
|
* Move benchmarks to bench/
|
||||||
|
|
||||||
WebSocket:
|
WebSocket:
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ cmake_minimum_required (VERSION 3.5.2)
|
|||||||
project (Beast VERSION 90)
|
project (Beast VERSION 90)
|
||||||
|
|
||||||
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
option (Beast_BUILD_BENCH "Build bench" ON)
|
||||||
option (Beast_BUILD_EXAMPLES "Build examples" ON)
|
option (Beast_BUILD_EXAMPLES "Build examples" ON)
|
||||||
option (Beast_BUILD_TESTS "Build tests" ON)
|
option (Beast_BUILD_TESTS "Build tests" ON)
|
||||||
|
|
||||||
@@ -189,8 +190,8 @@ file(GLOB_RECURSE EXTRAS_INCLUDES
|
|||||||
${PROJECT_SOURCE_DIR}/extras/boost/beast/*.ipp
|
${PROJECT_SOURCE_DIR}/extras/boost/beast/*.ipp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (Beast_BUILD_TESTS)
|
if (Beast_BUILD_BENCH)
|
||||||
add_subdirectory (test)
|
add_subdirectory (bench)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (Beast_BUILD_EXAMPLES AND
|
if (Beast_BUILD_EXAMPLES AND
|
||||||
@@ -198,3 +199,7 @@ if (Beast_BUILD_EXAMPLES AND
|
|||||||
(NOT "${VARIANT}" STREQUAL "ubasan"))
|
(NOT "${VARIANT}" STREQUAL "ubasan"))
|
||||||
add_subdirectory (example)
|
add_subdirectory (example)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (Beast_BUILD_TESTS)
|
||||||
|
add_subdirectory (test)
|
||||||
|
endif()
|
||||||
|
31
Jamfile
31
Jamfile
@@ -19,36 +19,36 @@ boost.use-project ;
|
|||||||
|
|
||||||
if [ os.name ] = SOLARIS
|
if [ os.name ] = SOLARIS
|
||||||
{
|
{
|
||||||
lib socket ;
|
lib socket ;
|
||||||
lib nsl ;
|
lib nsl ;
|
||||||
}
|
}
|
||||||
else if [ os.name ] = NT
|
else if [ os.name ] = NT
|
||||||
{
|
{
|
||||||
lib ws2_32 ;
|
lib ws2_32 ;
|
||||||
lib mswsock ;
|
lib mswsock ;
|
||||||
}
|
}
|
||||||
else if [ os.name ] = HPUX
|
else if [ os.name ] = HPUX
|
||||||
{
|
{
|
||||||
lib ipv6 ;
|
lib ipv6 ;
|
||||||
}
|
}
|
||||||
else if [ os.name ] = QNXNTO
|
else if [ os.name ] = QNXNTO
|
||||||
{
|
{
|
||||||
lib socket ;
|
lib socket ;
|
||||||
}
|
}
|
||||||
else if [ os.name ] = HAIKU
|
else if [ os.name ] = HAIKU
|
||||||
{
|
{
|
||||||
lib network ;
|
lib network ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ os.name ] = NT
|
if [ os.name ] = NT
|
||||||
{
|
{
|
||||||
lib ssl : : <name>ssleay32 ;
|
lib ssl : : <name>ssleay32 ;
|
||||||
lib crypto : : <name>libeay32 ;
|
lib crypto : : <name>libeay32 ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lib ssl ;
|
lib ssl ;
|
||||||
lib crypto ;
|
lib crypto ;
|
||||||
}
|
}
|
||||||
|
|
||||||
variant coverage :
|
variant coverage :
|
||||||
@@ -59,16 +59,18 @@ variant coverage :
|
|||||||
;
|
;
|
||||||
|
|
||||||
variant ubasan
|
variant ubasan
|
||||||
:
|
:
|
||||||
release
|
release
|
||||||
:
|
:
|
||||||
<cxxflags>"-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=libs/beast/scripts/blacklist.supp"
|
<cxxflags>"-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=libs/beast/scripts/blacklist.supp"
|
||||||
<linkflags>"-fsanitize=address,undefined"
|
<linkflags>"-fsanitize=address,undefined"
|
||||||
;
|
;
|
||||||
|
|
||||||
#cxx11_hdr_type_traits
|
#cxx11_hdr_type_traits
|
||||||
local REQ = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_hdr_tuple ] ;
|
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
|
project beast
|
||||||
: requirements
|
: requirements
|
||||||
#$(REQ)
|
#$(REQ)
|
||||||
@@ -79,6 +81,7 @@ project beast
|
|||||||
<library>/boost/system//boost_system
|
<library>/boost/system//boost_system
|
||||||
<library>/boost/coroutine//boost_coroutine/<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
<library>/boost/coroutine//boost_coroutine/<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
||||||
<library>/boost/filesystem//boost_filesystem
|
<library>/boost/filesystem//boost_filesystem
|
||||||
|
<link>static
|
||||||
<define>BOOST_ALL_NO_LIB=1
|
<define>BOOST_ALL_NO_LIB=1
|
||||||
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
||||||
<threading>multi
|
<threading>multi
|
||||||
|
@@ -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
|
bin/ Create this to hold executables and project files
|
||||||
bin64/ Create this to hold 64-bit Windows executables and project files
|
bin64/ Create this to hold 64-bit Windows executables and project files
|
||||||
doc/ Source code and scripts for the documentation
|
doc/ Source code and scripts for the documentation
|
||||||
include/ Add this to your compiler includes
|
include/ Where the header files live
|
||||||
beast/
|
|
||||||
extras/ Additional APIs, may change
|
extras/ Additional APIs, may change
|
||||||
example/ Self contained example programs
|
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
|
## Usage
|
||||||
|
@@ -16,11 +16,13 @@ add_executable (benchmarks
|
|||||||
${BOOST_BEAST_INCLUDES}
|
${BOOST_BEAST_INCLUDES}
|
||||||
${EXTRAS_INCLUDES}
|
${EXTRAS_INCLUDES}
|
||||||
Jamfile
|
Jamfile
|
||||||
../../extras/boost/beast/unit_test/main.cpp
|
../extras/boost/beast/unit_test/main.cpp
|
||||||
../http/message_fuzz.hpp
|
../test/http/message_fuzz.hpp
|
||||||
nodejs_parser.hpp
|
nodejs_parser.hpp
|
||||||
buffers.cpp
|
|
||||||
nodejs_parser.cpp
|
nodejs_parser.cpp
|
||||||
|
buffers.cpp
|
||||||
parser.cpp
|
parser.cpp
|
||||||
utf8_checker.cpp
|
utf8_checker.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory (wstest)
|
@@ -9,13 +9,14 @@
|
|||||||
|
|
||||||
local SOURCES =
|
local SOURCES =
|
||||||
buffers.cpp
|
buffers.cpp
|
||||||
nodejs_parser.cpp
|
utf8_checker.cpp # causes unnecessary dependencies
|
||||||
parser.cpp
|
|
||||||
#utf8_checker.cpp # causes unnecessary dependencies
|
|
||||||
;
|
;
|
||||||
|
|
||||||
unit-test run-fat : $(TEST_MAIN) $(SOURCES) : : : <variant>coverage:<build>no <variant>ubasan:<build>no ;
|
local BUILD_BENCH ; for local f in $(SOURCES) { BUILD_BENCH += [ exe $(f:B)-bench : $(f) $(TEST_MAIN) ] ; }
|
||||||
explicit run-fat ;
|
alias build-bench : $(BUILD_BENCH) ;
|
||||||
|
|
||||||
exe build-fat : $(TEST_MAIN) $(SOURCES) : : : <variant>coverage:<build>no <variant>ubasan:<build>no ;
|
exe parser-bench :
|
||||||
explicit build-fat ;
|
nodejs_parser.cpp
|
||||||
|
parser.cpp
|
||||||
|
$(TEST_MAIN)
|
||||||
|
;
|
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "nodejs_parser.hpp"
|
#include "nodejs_parser.hpp"
|
||||||
#include "../http/message_fuzz.hpp"
|
#include "test/http/message_fuzz.hpp"
|
||||||
|
|
||||||
#include <boost/beast/http.hpp>
|
#include <boost/beast/http.hpp>
|
||||||
#include <boost/beast/core/consuming_buffers.hpp>
|
#include <boost/beast/core/consuming_buffers.hpp>
|
@@ -9,10 +9,17 @@
|
|||||||
|
|
||||||
#include <boost/beast/websocket/detail/utf8_checker.hpp>
|
#include <boost/beast/websocket/detail/utf8_checker.hpp>
|
||||||
#include <boost/beast/unit_test/suite.hpp>
|
#include <boost/beast/unit_test/suite.hpp>
|
||||||
#include <boost/locale.hpp>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <random>
|
#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 boost {
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@@ -79,6 +86,14 @@ public:
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
checkBeast(std::string const& s)
|
||||||
|
{
|
||||||
|
beast::websocket::detail::check_utf8(
|
||||||
|
s.data(), s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
#if BEAST_USE_BOOST_LOCALE_BENCHMARK
|
||||||
void
|
void
|
||||||
checkLocale(std::string const& s)
|
checkLocale(std::string const& s)
|
||||||
{
|
{
|
||||||
@@ -92,13 +107,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
void
|
|
||||||
checkBeast(std::string const& s)
|
|
||||||
{
|
|
||||||
beast::websocket::detail::check_utf8(
|
|
||||||
s.data(), s.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class F>
|
template<class F>
|
||||||
typename timer::clock_type::duration
|
typename timer::clock_type::duration
|
||||||
@@ -124,6 +133,7 @@ public:
|
|||||||
});
|
});
|
||||||
log << "beast: " << throughput(elapsed, s.size()) << " char/s" << std::endl;
|
log << "beast: " << throughput(elapsed, s.size()) << " char/s" << std::endl;
|
||||||
}
|
}
|
||||||
|
#if BEAST_USE_BOOST_LOCALE_BENCHMARK
|
||||||
for(int i = 0; i < 5; ++ i)
|
for(int i = 0; i < 5; ++ i)
|
||||||
{
|
{
|
||||||
auto const elapsed = test([&]{
|
auto const elapsed = test([&]{
|
||||||
@@ -135,6 +145,7 @@ public:
|
|||||||
});
|
});
|
||||||
log << "locale: " << throughput(elapsed, s.size()) << " char/s" << std::endl;
|
log << "locale: " << throughput(elapsed, s.size()) << " char/s" << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
pass();
|
pass();
|
||||||
}
|
}
|
||||||
};
|
};
|
@@ -10,7 +10,7 @@
|
|||||||
GroupSources(include/boost/beast beast)
|
GroupSources(include/boost/beast beast)
|
||||||
GroupSources(example/common common)
|
GroupSources(example/common common)
|
||||||
GroupSources(extras/boost/beast extras)
|
GroupSources(extras/boost/beast extras)
|
||||||
GroupSources(test/wstest "/")
|
GroupSources(bench/wstest "/")
|
||||||
|
|
||||||
add_executable (wstest
|
add_executable (wstest
|
||||||
${BOOST_BEAST_INCLUDES}
|
${BOOST_BEAST_INCLUDES}
|
@@ -7,9 +7,6 @@
|
|||||||
# Official repository: https://github.com/boostorg/beast
|
# Official repository: https://github.com/boostorg/beast
|
||||||
#
|
#
|
||||||
|
|
||||||
alias wstest :
|
exe wstest :
|
||||||
wstest.cpp
|
wstest.cpp
|
||||||
;
|
;
|
||||||
explicit wstest ;
|
|
||||||
|
|
||||||
alias run-tests : [ compile wstest.cpp ] : : : <variant>coverage:<build>no <variant>ubasan:<build>no ;
|
|
@@ -10,13 +10,11 @@
|
|||||||
add_subdirectory (core)
|
add_subdirectory (core)
|
||||||
add_subdirectory (http)
|
add_subdirectory (http)
|
||||||
add_subdirectory (websocket)
|
add_subdirectory (websocket)
|
||||||
add_subdirectory (wstest)
|
|
||||||
add_subdirectory (zlib)
|
add_subdirectory (zlib)
|
||||||
|
|
||||||
if ((NOT "${VARIANT}" STREQUAL "coverage") AND
|
if ((NOT "${VARIANT}" STREQUAL "coverage") AND
|
||||||
(NOT "${VARIANT}" STREQUAL "ubasan"))
|
(NOT "${VARIANT}" STREQUAL "ubasan"))
|
||||||
|
|
||||||
add_subdirectory (benchmarks)
|
|
||||||
add_subdirectory (common)
|
add_subdirectory (common)
|
||||||
add_subdirectory (server)
|
add_subdirectory (server)
|
||||||
|
|
||||||
|
@@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
import os ;
|
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 config.cpp : <variant>coverage:<build>no <variant>ubasan:<build>no ;
|
||||||
compile core.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 ;
|
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 ;
|
compile zlib.cpp : <variant>coverage:<build>no <variant>ubasan:<build>no ;
|
||||||
|
|
||||||
alias run-tests :
|
alias run-tests :
|
||||||
#benchmarks//run-tests # not necessary
|
|
||||||
common//run-tests
|
common//run-tests
|
||||||
core//run-tests
|
core//run-tests
|
||||||
http//run-tests
|
http//run-tests
|
||||||
server//run-tests
|
server//run-tests
|
||||||
websocket//run-tests
|
websocket//run-tests
|
||||||
wstest//run-tests
|
|
||||||
zlib//run-tests
|
zlib//run-tests
|
||||||
;
|
;
|
||||||
|
|
||||||
alias run-fat :
|
alias run-fat :
|
||||||
benchmarks//run-fat
|
|
||||||
common//run-fat
|
common//run-fat
|
||||||
core//run-fat
|
core//run-fat
|
||||||
http//run-fat
|
http//run-fat
|
||||||
server//run-fat
|
server//run-fat
|
||||||
websocket//run-fat
|
websocket//run-fat
|
||||||
#wstest//run-fat # not available
|
|
||||||
zlib//run-fat
|
zlib//run-fat
|
||||||
;
|
;
|
||||||
explicit run-fat ;
|
explicit run-fat ;
|
||||||
|
|
||||||
alias build-fat :
|
alias build-fat :
|
||||||
benchmarks//build-fat
|
|
||||||
common//build-fat
|
common//build-fat
|
||||||
core//build-fat
|
core//build-fat
|
||||||
http//build-fat
|
http//build-fat
|
||||||
server//build-fat
|
server//build-fat
|
||||||
websocket//build-fat
|
websocket//build-fat
|
||||||
#wstest//build-fat # not available
|
|
||||||
zlib//build-fat
|
zlib//build-fat
|
||||||
;
|
;
|
||||||
explicit build-fat ;
|
explicit build-fat ;
|
||||||
|
Reference in New Issue
Block a user