Skip to content

Commit 177777e

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
switch from all_of to for-loop in ThreadEntrySet::basicSanity()
Summary: In non-optimized ASAN-instrumented builds, the `all_of` has a measurable cost. Reviewed By: dmm-fb Differential Revision: D76755340 fbshipit-source-id: 0326dfa603853e055074feea9d51f5a5cf7d1f17
1 parent e249524 commit 177777e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

third-party/folly/src/folly/detail/ThreadLocalDetail.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,13 @@ bool ThreadEntrySet::basicSanity() const {
7373
if (!(dist(rng) < constexpr_log2(size))) {
7474
return true;
7575
}
76-
return //
77-
threadElements.size() == entryToVectorSlot.size() &&
78-
std::all_of(
79-
entryToVectorSlot.begin(),
80-
entryToVectorSlot.end(),
81-
[&](auto const& kvp) {
82-
return kvp.second < threadElements.size() &&
83-
threadElements[kvp.second].threadEntry == kvp.first;
84-
});
76+
for (auto const& kvp : entryToVectorSlot) {
77+
if (!(kvp.second < threadElements.size() &&
78+
threadElements[kvp.second].threadEntry == kvp.first)) {
79+
return false;
80+
}
81+
}
82+
return true;
8583
}
8684

8785
void ThreadEntrySet::clear() {

0 commit comments

Comments
 (0)