Skip to content

Commit 9046cd0

Browse files
committed
Separate speedtest setup, process review comments
1 parent a5962f6 commit 9046cd0

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pdns/speedtest.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,18 +1186,7 @@ struct DedupRecordsTest
11861186
{
11871187
explicit DedupRecordsTest(size_t howmany, bool dedup, bool withdup = false) : d_howmany(howmany), d_dedup(dedup), d_withdup(withdup)
11881188
{
1189-
}
1190-
1191-
[[nodiscard]] string getName() const
1192-
{
1193-
return std::to_string(d_howmany) + " DedupRecords" + std::string(d_dedup ? "" : " (generate only)") +
1194-
std::string(d_withdup ? " (with dup)" : "");
1195-
}
1196-
1197-
void operator()() const
1198-
{
1199-
std::vector<DNSRecord> vec;
1200-
vec.reserve(d_howmany);
1189+
d_vec.reserve(d_howmany);
12011190
std::string name("some.name.in.some.domain");
12021191
auto count = d_howmany;
12031192
if (d_withdup) {
@@ -1207,17 +1196,28 @@ struct DedupRecordsTest
12071196
auto content = DNSRecordContent::make(QType::TXT, QClass::IN, "\"a text " + std::to_string(i) + "\"");
12081197
DNSRecord rec(name, content, QType::TXT);
12091198
if (i == 0 && d_withdup) {
1210-
vec.emplace_back(rec);
1199+
d_vec.emplace_back(rec);
12111200
}
1212-
vec.emplace_back(std::move(rec));
1201+
d_vec.emplace_back(std::move(rec));
12131202
}
1203+
}
1204+
1205+
[[nodiscard]] string getName() const
1206+
{
1207+
return std::to_string(d_howmany) + " DedupRecords" + std::string(d_dedup ? "" : " (setup only)") +
1208+
std::string(d_withdup ? " (with dup)" : "");
1209+
}
12141210

1211+
void operator()() const
1212+
{
1213+
auto vec{d_vec};
12151214
if (d_dedup) {
12161215
pdns::dedupRecords(vec);
12171216
}
12181217
}
12191218

12201219
private:
1220+
vector<DNSRecord> d_vec;
12211221
size_t d_howmany;
12221222
bool d_dedup;
12231223
bool d_withdup;

0 commit comments

Comments
 (0)