mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 03:47:16 +02:00
Add BOOST_NOINLINE to benchmark test functions
This commit is contained in:
@ -9,6 +9,7 @@
|
|||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/member.hpp>
|
#include <boost/multi_index/member.hpp>
|
||||||
#include <boost/core/detail/splitmix64.hpp>
|
#include <boost/core/detail/splitmix64.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
# include "absl/container/node_hash_map.h"
|
# include "absl/container/node_hash_map.h"
|
||||||
# include "absl/container/flat_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 )
|
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;
|
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;
|
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;
|
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();
|
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;
|
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 )
|
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;
|
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";
|
std::cout << label << ":\n\n";
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/member.hpp>
|
#include <boost/multi_index/member.hpp>
|
||||||
#include <boost/core/detail/splitmix64.hpp>
|
#include <boost/core/detail/splitmix64.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
# include "absl/container/node_hash_map.h"
|
# include "absl/container/node_hash_map.h"
|
||||||
# include "absl/container/flat_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 )
|
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;
|
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;
|
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;
|
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();
|
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;
|
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 )
|
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;
|
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";
|
std::cout << label << ":\n\n";
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/member.hpp>
|
#include <boost/multi_index/member.hpp>
|
||||||
#include <boost/core/detail/splitmix64.hpp>
|
#include <boost/core/detail/splitmix64.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#ifdef HAVE_ABSEIL
|
#ifdef HAVE_ABSEIL
|
||||||
# include "absl/container/node_hash_map.h"
|
# include "absl/container/node_hash_map.h"
|
||||||
# include "absl/container/flat_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 )
|
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;
|
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;
|
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;
|
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();
|
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;
|
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 )
|
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;
|
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";
|
std::cout << label << ":\n\n";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user