refactor: Preallocate PrevectorFillVector(In)Direct without vector resize

The prevector benchmarks were likely not trying to measure vector resize performance.
This commit is contained in:
Lőrinc 2024-11-18 16:18:10 +01:00
parent a774c7a339
commit 152fefe7a2

View file

@ -87,6 +87,7 @@ static void PrevectorFillVectorDirect(benchmark::Bench& bench)
{
bench.run([&] {
std::vector<prevector<28, T>> vec;
vec.reserve(260);
for (size_t i = 0; i < 260; ++i) {
vec.emplace_back();
}
@ -99,6 +100,7 @@ static void PrevectorFillVectorIndirect(benchmark::Bench& bench)
{
bench.run([&] {
std::vector<prevector<28, T>> vec;
vec.reserve(260);
for (size_t i = 0; i < 260; ++i) {
// force allocation
vec.emplace_back(29, T{});