Skip to content

Commit 1b794a0

Browse files
committed
Reserve the vectors the new cpu affinity tests fill in a loop
1 parent 1ecb34d commit 1b794a0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎engine/src/flutter/fml/cpu_affinity_unittests.cc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ TEST(CpuAffinity, NoLittleCores) {
3838
// Two prime and six performance cores, as read on a Snapdragon 8 Elite
3939
// Gen 5: the slowest cores are three quarters of the fastest.
4040
std::vector<CpuIndexAndSpeed> speeds;
41+
speeds.reserve(8);
4142
for (size_t i = 0; i < 8; i++) {
4243
speeds.push_back({.index = i,
4344
.speed = i < 6 ? 3628800 : 4608000,
@@ -72,6 +73,7 @@ TEST(CpuAffinity, CapacitiesThatSayNothing) {
7273
{std::vector<std::optional<int64_t>>{1024, 1024, 1024},
7374
std::vector<std::optional<int64_t>>{762, std::nullopt, 1024}}) {
7475
std::vector<CpuIndexAndSpeed> speeds;
76+
speeds.reserve(3);
7577
for (size_t i = 0; i < 3; i++) {
7678
speeds.push_back({.index = i,
7779
.speed = static_cast<int64_t>(i + 1),

0 commit comments

Comments
 (0)