-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP add benchmark for impact of ureact root includes on compilation t…
…imes
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Copyright (C) 2020-2023 Krylov Yaroslav. | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
#if defined( INCLUDE_CONTEXT ) or defined( INCLUDE_ALL ) | ||
# include <ureact/context.hpp> | ||
#endif | ||
|
||
#if defined( INCLUDE_EVENTS ) or defined( INCLUDE_ALL ) | ||
# include <ureact/events.hpp> | ||
#endif | ||
|
||
#if defined( INCLUDE_OBSERVER ) or defined( INCLUDE_ALL ) | ||
# include <ureact/observer.hpp> | ||
#endif | ||
|
||
#if defined( INCLUDE_SIGNAL ) or defined( INCLUDE_ALL ) | ||
# include <ureact/signal.hpp> | ||
#endif | ||
|
||
int main() | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// Copyright (C) 2020-2023 Krylov Yaroslav. | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
#include <algorithm> | ||
#include <cassert> | ||
#include <string> | ||
|
||
#include <catch2/catch_test_macros.hpp> | ||
#include <nanobench.h> | ||
|
||
#include "compiler_args.hpp" | ||
|
||
TEST_CASE( "ureact headers include time" ) | ||
{ | ||
using namespace std::chrono_literals; | ||
|
||
ankerl::nanobench::Bench bench; | ||
bench.title( "ureact headers include time" ); | ||
bench.relative( true ); | ||
bench.performanceCounters( false ); | ||
bench.timeUnit( 1ms, "ms" ); | ||
bench.minEpochIterations( 1 ); | ||
|
||
std::vector compilers = { | ||
Compiler{ gcc, 9 }, | ||
Compiler{ gcc, 10 }, | ||
Compiler{ gcc, 11 }, | ||
Compiler{ gcc, 12 }, | ||
Compiler{ clang, 11 }, | ||
Compiler{ clang, 12 }, | ||
Compiler{ clang, 13 }, | ||
Compiler{ clang, 14 }, | ||
}; | ||
|
||
const auto args = generateCompilerArgs( | ||
compilers, { BuildConfiguration::Debug, BuildConfiguration::Release }, 17 ); | ||
for( const auto& compilerArgs : args ) | ||
{ | ||
const auto compilerString = compilerArgs.get_name(); | ||
|
||
for( const std::string& type : { | ||
"all", | ||
"context", | ||
"events", | ||
"observer", | ||
"signal", | ||
} ) | ||
{ | ||
for( bool useStdAlgorithm : { false, true } ) | ||
{ | ||
auto stdCompilerArgs = CompilerArgs{ compilerArgs } // | ||
.source( "include_ureact.cpp" ); | ||
std::string definition = "INCLUDE_" + type; | ||
std::transform( | ||
definition.begin(), definition.end(), definition.begin(), ::toupper ); | ||
stdCompilerArgs.definition( definition ); | ||
if( useStdAlgorithm ) | ||
stdCompilerArgs.definition( "UREACT_USE_STD_ALGORITHM" ); | ||
|
||
perform_test( bench, | ||
type + " (" + compilerString + ") " | ||
+ ( useStdAlgorithm ? "std algorithm" : "ureact algorithm" ), | ||
stdCompilerArgs ); | ||
} | ||
} | ||
} | ||
} |