Add BOOST_NOINLINE to benchmark test functions

This commit is contained in:
Peter Dimov
2022-03-07 21:43:36 +02:00
parent 35475a260f
commit 5bcb07dc7f
3 changed files with 18 additions and 15 deletions

View File

@ -9,6 +9,7 @@
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/config.hpp>
#ifdef HAVE_ABSEIL
# include "absl/container/node_hash_map.h"
# include "absl/container/flat_hash_map.h"
@ -74,7 +75,7 @@ static void init_indices()
}
}
template<class Map> void test_insert( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_insert( Map& map, std::chrono::steady_clock::time_point & t1 )
{
for( unsigned i = 1; i <= N; ++i )
{
@ -93,7 +94,7 @@ template<class Map> void test_insert( Map& map, std::chrono::steady_clock::time_
std::cout << std::endl;
}
template<class Map> void test_lookup( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_lookup( Map& map, std::chrono::steady_clock::time_point & t1 )
{
std::uint32_t s;
@ -126,7 +127,7 @@ template<class Map> void test_lookup( Map& map, std::chrono::steady_clock::time_
std::cout << std::endl;
}
template<class Map> void test_iteration( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_iteration( Map& map, std::chrono::steady_clock::time_point & t1 )
{
auto it = map.begin();
@ -147,7 +148,7 @@ template<class Map> void test_iteration( Map& map, std::chrono::steady_clock::ti
std::cout << std::endl;
}
template<class Map> void test_erase( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_erase( Map& map, std::chrono::steady_clock::time_point & t1 )
{
for( unsigned i = 1; i <= N; ++i )
{
@ -172,7 +173,7 @@ template<class Map> void test_erase( Map& map, std::chrono::steady_clock::time_p
static std::vector< std::pair<std::string, long long> > times;
template<template<class...> class Map> void test( char const* label )
template<template<class...> class Map> BOOST_NOINLINE void test( char const* label )
{
std::cout << label << ":\n\n";

View File

@ -9,6 +9,7 @@
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/config.hpp>
#ifdef HAVE_ABSEIL
# include "absl/container/node_hash_map.h"
# include "absl/container/flat_hash_map.h"
@ -63,7 +64,7 @@ static void init_indices()
}
}
template<class Map> void test_insert( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_insert( Map& map, std::chrono::steady_clock::time_point & t1 )
{
for( unsigned i = 1; i <= N; ++i )
{
@ -89,7 +90,7 @@ template<class Map> void test_insert( Map& map, std::chrono::steady_clock::time_
std::cout << std::endl;
}
template<class Map> void test_lookup( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_lookup( Map& map, std::chrono::steady_clock::time_point & t1 )
{
std::uint32_t s;
@ -135,7 +136,7 @@ template<class Map> void test_lookup( Map& map, std::chrono::steady_clock::time_
std::cout << std::endl;
}
template<class Map> void test_iteration( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_iteration( Map& map, std::chrono::steady_clock::time_point & t1 )
{
auto it = map.begin();
@ -156,7 +157,7 @@ template<class Map> void test_iteration( Map& map, std::chrono::steady_clock::ti
std::cout << std::endl;
}
template<class Map> void test_erase( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_erase( Map& map, std::chrono::steady_clock::time_point & t1 )
{
for( unsigned i = 1; i <= N; ++i )
{
@ -188,7 +189,7 @@ template<class Map> void test_erase( Map& map, std::chrono::steady_clock::time_p
static std::vector< std::pair<std::string, long long> > times;
template<template<class...> class Map> void test( char const* label )
template<template<class...> class Map> BOOST_NOINLINE void test( char const* label )
{
std::cout << label << ":\n\n";

View File

@ -9,6 +9,7 @@
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/core/detail/splitmix64.hpp>
#include <boost/config.hpp>
#ifdef HAVE_ABSEIL
# include "absl/container/node_hash_map.h"
# include "absl/container/flat_hash_map.h"
@ -63,7 +64,7 @@ static void init_indices()
}
}
template<class Map> void test_insert( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_insert( Map& map, std::chrono::steady_clock::time_point & t1 )
{
for( unsigned i = 1; i <= N; ++i )
{
@ -89,7 +90,7 @@ template<class Map> void test_insert( Map& map, std::chrono::steady_clock::time_
std::cout << std::endl;
}
template<class Map> void test_lookup( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_lookup( Map& map, std::chrono::steady_clock::time_point & t1 )
{
std::uint64_t s;
@ -135,7 +136,7 @@ template<class Map> void test_lookup( Map& map, std::chrono::steady_clock::time_
std::cout << std::endl;
}
template<class Map> void test_iteration( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_iteration( Map& map, std::chrono::steady_clock::time_point & t1 )
{
auto it = map.begin();
@ -156,7 +157,7 @@ template<class Map> void test_iteration( Map& map, std::chrono::steady_clock::ti
std::cout << std::endl;
}
template<class Map> void test_erase( Map& map, std::chrono::steady_clock::time_point & t1 )
template<class Map> BOOST_NOINLINE void test_erase( Map& map, std::chrono::steady_clock::time_point & t1 )
{
for( unsigned i = 1; i <= N; ++i )
{
@ -188,7 +189,7 @@ template<class Map> void test_erase( Map& map, std::chrono::steady_clock::time_p
static std::vector< std::pair<std::string, long long> > times;
template<template<class...> class Map> void test( char const* label )
template<template<class...> class Map> BOOST_NOINLINE void test( char const* label )
{
std::cout << label << ":\n\n";