mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
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:
parent
a774c7a339
commit
152fefe7a2
1 changed files with 2 additions and 0 deletions
|
@ -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{});
|
||||
|
|
Loading…
Reference in a new issue