@@ -58,12 +58,13 @@ void operator delete(void* p) noexcept {
5858 free (p);
5959}
6060
61- template <typename T> void func (clad::tape<T>& t, T x, int n) {
61+ template <typename T, std::size_t SBO_SIZE = 64 , std::size_t SLAB_SIZE = 1024 >
62+ void func (clad::tape<T, SBO_SIZE , SLAB_SIZE >& t, T x, int n) {
6263 for (int i = 0 ; i < n; i++)
63- clad::push<T>(t, x);
64+ clad::push<T, SBO_SIZE , SLAB_SIZE >(t, x);
6465
6566 for (int i = 0 ; i < n; i++)
66- clad::pop<T>(t);
67+ clad::pop<T, SBO_SIZE , SLAB_SIZE >(t);
6768}
6869
6970static void BM_TapeMemory (benchmark::State& state) {
@@ -76,6 +77,25 @@ static void BM_TapeMemory(benchmark::State& state) {
7677}
7778BENCHMARK (BM_TapeMemory)->RangeMultiplier (2 )->Range(0 , 4096 )->Iterations(1 );
7879
80+ template <std::size_t SBO_SIZE , std::size_t SLAB_SIZE >
81+ static void BM_TapeMemory_Templated (benchmark::State& state) {
82+ int block = state.range (0 );
83+ AddBMCounterRAII MemCounters (*mm.get (), state);
84+ clad::tape<double , SBO_SIZE , SLAB_SIZE > t;
85+ for (auto _ : state)
86+ func<double , SBO_SIZE , SLAB_SIZE >(t, 1 , block * 2 + 1 );
87+ }
88+
89+ #define REGISTER_TAPE_BENCHMARK (sbo, slab ) \
90+ BENCHMARK_TEMPLATE (BM_TapeMemory_Templated, sbo, slab) \
91+ ->RangeMultiplier(2 ) \
92+ ->Range(0 , 4096 ) \
93+ ->Iterations(1 ) \
94+ ->Name(" BM_TapeMemory/SBO_" #sbo " _SLAB_" #slab)
95+
96+ REGISTER_TAPE_BENCHMARK(64 , 1024 );
97+ REGISTER_TAPE_BENCHMARK (32 , 512 );
98+
7999#include " BenchmarkedFunctions.h"
80100
81101static void BM_ReverseGausMemoryP (benchmark::State& state) {
0 commit comments