diff --git a/benchmarks/init.cpp b/benchmarks/init.cpp index 48bf505..9d99c95 100644 --- a/benchmarks/init.cpp +++ b/benchmarks/init.cpp @@ -93,7 +93,31 @@ auto BMInitialise(benchmark::State& state) { state.ResumeTiming(); }; }; +auto BMInitialiseWithoutSort(benchmark::State& state) { + using Builder = decltype(cserver::ServiceContextBuilder{} + .AppendConfigParam<"threads", 8>() + .Append() + .Append() + .Append() + .Append() + .Append() + .Append() + .Append() + .Append()); + using ServiceContextType = decltype(Builder::GetServiceContext()); + alignas(ServiceContextType) std::byte context[sizeof(ServiceContextType)]; + for(auto _ : state) { + auto* ptr = new (context) ServiceContextType{}; + ptr->Run(); + ptr->FindComponent().ioContext.run(); + state.PauseTiming(); + ptr->~ServiceContextType(); + state.ResumeTiming(); + }; +}; + BENCHMARK(BMInitialise); +BENCHMARK(BMInitialiseWithoutSort); BENCHMARK_MAIN();