#include "core/small_obj.hpp" #include #include template static void BM_std_shared_ptr(benchmark::State &state) { struct test_type { double data[length]; }; for (auto _: state) { benchmark::DoNotOptimize(std::make_shared()); } } BENCHMARK(BM_std_shared_ptr<0>); BENCHMARK(BM_std_shared_ptr<1>); BENCHMARK(BM_std_shared_ptr<8>); BENCHMARK(BM_std_shared_ptr<16>); BENCHMARK(BM_std_shared_ptr<128>); template static void BM_small_obj(benchmark::State &state) { struct test_type : public sophiar::small_obj { double data[length]; }; for (auto _: state) { benchmark::DoNotOptimize(test_type::new_instance()); } } BENCHMARK(BM_small_obj<0>); BENCHMARK(BM_small_obj<1>); BENCHMARK(BM_small_obj<8>); BENCHMARK(BM_small_obj<16>); BENCHMARK(BM_small_obj<128>); BENCHMARK_MAIN();