Skip to content

Commit bcf9b97

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

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

pdns/recursordist/pdns_recursor.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,9 @@ void startDoResolve(void* arg) // NOLINT(readability-function-cognitive-complexi
15131513

15141514
if (!ret.empty()) {
15151515
#ifdef notyet
1516+
// As dedupping is relatively expensive do not dedup in general. We do have a few cases
1517+
// where we call dedup explicitly, e.g. when doing NAT64 or when adding NSEC records in
1518+
// doCNAMECacheCheck
15161519
pdns::dedupRecords(ret);
15171520
#endif
15181521
pdns::orderAndShuffle(ret, false);

pdns/recursordist/syncres.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4448,6 +4448,7 @@ void SyncRes::sanitizeRecordsPass2(const std::string& prefix, LWResult& lwr, con
44484448
lwr.d_records = std::move(vec);
44494449
}
44504450
#ifdef notyet
4451+
// As dedupping is relatively expensive and having dup records not really hurts as far as we have seen, do not dedup.
44514452
if (auto count = pdns::dedupRecords(lwr.d_records); count > 0) {
44524453
LOG(prefix << qname << ": Removed " << count << " duplicate records from response received from " << auth << endl);
44534454
}

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)