Commit 2890217b by Abseil Team Committed by Copybara-Service

Speed up kTotalMorePrecise mode of Cord::EstimatedMemoryUsage() by about 25% by…

Speed up kTotalMorePrecise mode of Cord::EstimatedMemoryUsage() by about 25% by avoiding a redundant map lookup.

PiperOrigin-RevId: 556816759
Change-Id: I971e428bf12d91720df72a91cc0bdf0513b0c270
parent 861e53c8
......@@ -67,8 +67,7 @@ struct RawUsage<Mode::kTotalMorePrecise> {
std::unordered_set<const CordRep*> counted;
void Add(size_t size, CordRepRef<Mode::kTotalMorePrecise> repref) {
if (counted.find(repref.rep) == counted.end()) {
counted.insert(repref.rep);
if (counted.insert(repref.rep).second) {
total += size;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment